gpt4 book ai didi

php - 碳/日期时间 : The timezone could not be found in the database

转载 作者:行者123 更新时间:2023-12-04 02:10:33 26 4
gpt4 key购买 nike

我正在读取带有日期时间字段的 CSV 文件,但是当我尝试通过执行 $date = new Carbon($row['date'])< 将日期转换为 Carbon 我收到以下错误之一:

DateTime::__construct(): Failed to parse time string (09/07/2014 16:55:22 MEST) at position 20 (M): The timezone could not be found in the database

DateTime::__construct(): Failed to parse time string (24/01/2014 16:57:27 MET) at position 0 (2): Unexpected character

PHP 似乎无法识别 MET/MEST 时区。如何动态转换任何非标准时区以创建 Carbon/DateTime 对象?

最佳答案

格式可能不是可识别的格式。改用这个。它只适用于 MET,因为 MEST 不是 valid timezone

$date = Carbon::createFromFormat('d/m/Y H:i:s T', $row['date']);

关于php - 碳/日期时间 : The timezone could not be found in the database,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38922251/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com