我以以下格式接收数据库的date参数:
"date" => "2015/08/11T00:00:00Z"
我需要得到正确的日期格式发送一个地区(在Laravel App::getLocale())参数。
像这样:
<? date_format_magicfunction($my_date, 'es' ); ?> // 11/08/2015
或
//es, en, de, etc
<? date_format_magicfunction($my_date, App::getLocale() ); ?> // 11/08/2015
你知道一些函数或Laravel Provider吗?
如果您正在使用php,您可以使用DateTime DateTime::createFromFormat()从任何格式创建日期,如您指定的日志,因为它是在API上指示的。注意这个函数的返回值是一个对象。
使用碳包装。http://carbon.nesbot.com/docs/#api-formatting它包含了很多操作datetime对象的方法