更改日期格式laravel 5 [英] Change date format laravel 5
本文介绍了更改日期格式laravel 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要更改日期格式存在问题. 这是我的看法:
i have something problem in there i want to change date format. this my view :
@foreach ($posts as $post)
<tr>
<td>
<?php echo $post->id?>
</td>
<td class="mailbox-star"><?php echo $post->nama?></td>
<td class="mailbox-name"><?php echo $post->tanggal?></td>
<td class="mailbox-subject"><?php echo $post->deskripsi?></td>
<td class="mailbox-date"><?php echo $post->mulai?> - <?php echo $post->durasi?></td>
<td class="mailbox-date"><?php echo $post->total?> Jam</td>
<td class="mailbox-date">
<a href="<?php echo url('user/detail/'.$post->nama)?>" class="btn btn-xs btn-danger"><i class="fa fa-search-plus"></i></a>
<a href="<?php echo url('user/edit/'.$post->id)?>" class="btn btn-xs btn-success"><i class="fa fa-pencil-square-o"></i></a>
<a href="<?php echo url('user/delete/'.$post->id) ?>" class="btn btn-xs btn-warning"><i class="fa fa-times"></i></a>
</td>
</tr>
@endforeach
和我的控制器:
public function getIndex()
{
$posts = DB::table("lembur_karyawan")
->orderBy('id', 'desc')
->paginate(6);
return view('user',['posts'=>$posts]);
}
这是我的观点和我想做的事情
this my view and what i want to do:
如果有人告诉我使用碳,请解释如何使用碳?
if someone tell me to use carbon please explain how to use it ?
注意:我使用laravel 5.1
NB : i use laravel 5.1
推荐答案
尝试一下:
<?php echo date('d F Y', strtotime($post->tanggal)); ?>
哪里
- d-每月的某天(从01到31)
- F-全文 一个月(从一月到十二月)的表示形式
- Y-四位数 一年的表示形式
- d - The day of the month (from 01 to 31)
- F - A full textual representation of a month (January through December)
- Y - A four digit representation of a year
这篇关于更改日期格式laravel 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文