0
如何创建一个可读的生日,如1990年1月1日在laravel中使用碳。碳创建可读生日
在我user.php的(模型)我有我的数据库
public function getBirthdayAttribute($birthday)
{
return $this->attributes['birthday'] = \Carbon\Carbon::????($birthday);
}
得到一个生日列的函数如何从MySQL数据库得到的生日,并返回它像1990年1月1日或像你的生日等待1个月之前等等等等等等。 :d
感谢
1990年1月1日如何? – yaeykay 2014-09-30 07:36:50
return \ Carbon \ Carbon :: parse($ birthday) - > toDateTimeString(); 结果:1990-01-01 00:00:00 – yaeykay 2014-09-30 07:40:27
' - > format('F j,Y');' - 阅读https://github.com/briannesbitt/Carbon和http://的文档php.net/manual/en/class.datetime.php – 2014-09-30 07:41:16