[英]Laravel 4 form Date formatting
I am having trying to retrive created at date from datebase on edit form: in database saved in timestamp format. 我试图从编辑表单上的日期数据库中检索在日期创建的内容:以时间戳格式保存的数据库。 how to retrive date in custom format
如何以自定义格式检索日期
{{ Form::text('project_start', Input::old('name'), array('class' => 'form-control')) }}
You can define an Accessor method in your related model class: 您可以在相关的模型类中定义一个Accessor方法:
public function getCreatedAtAttribute($value)
{
return date("Y/m/d", strtotime($value));
}
More on documentations 有关文档的更多信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.