Laravel中Carbon时间格式本地化

当你使用Laravel中自带的时间戳时,可生效
https://9iphp.com/web/laravel/laravel-carbon-localization.html
http://carbon.nesbot.com/docs/
$dt = Carbon::create(1975, 12, 25, 14, 15, 16);

var_dump($dt->toDateTimeString() == $dt); // bool(true) => uses __toString()
echo $dt->toDateString(); // 1975-12-25
echo $dt->toFormattedDateString(); // Dec 25, 1975
echo $dt->toTimeString(); // 14:15:16
echo $dt->toDateTimeString(); // 1975-12-25 14:15:16
echo $dt->toDayDateTimeString(); // Thu, Dec 25, 1975 2:15 PM

// ... of course format() is still available
echo $dt->format('l jS \\of F Y h:i:s A'); // Thursday 25th of December 1975 02:15:16 PM

你可能感兴趣的:(php-Larave)