laravel 使用maatwebsite/Excel 获取的日期的处理

鑫鑫
阅读 746 标签:php  
use Carbon\Carbon;
use PhpOffice\PhpSpreadsheet\Shared\Date;



public static function transformDateTime(string $value, string $format = 'Y-m-d')
{
    try {
        return Carbon::instance(Date::excelToDateTimeObject($value))->format($format);
    } catch (\ErrorException $e) {
        return Carbon::createFromFormat($format, $value);
    }
}
文章来源:网络 版权归原作者所有,如涉及知识产权问题,请权利人联系我们,我们将立即处理.
标签: php
鑫鑫
文章 48 获得 0个赞 共 0个粉丝

推荐阅读 更多精彩内容