gpt4 book ai didi

php - 持续联系 API 错误 :"Scheduled date is before the current time."

转载 作者:搜寻专家 更新时间:2023-10-31 21:35:54 27 4
gpt4 key购买 nike

我们目前正在使用 API 来创建事件,一切似乎都运行良好。然而,当我们尝试安排事件时,我们遇到了错误。当我们尝试使用来自 SDK 库之一的“schedule_date”示例格式时:

$time =  date('Y-m-d\TH:i:s\.000\Z', strtotime("+1 hour"));
$schedule = new Schedule();
$schedule->scheduled_date = $time;

我们得到一个错误说

Scheduled date is before the current time.

当我们将 $time 回显到屏幕上时,我们看到实际上是 future 一小时。 (我们在美国东部时间)。

当我们尝试使用 ISO-8601 的标准 PHP 格式(小写的“c”)时,我们得到错误提示

"#/scheduled_date: Value is not a valid ISO-8601 date time format."

$dt =  date('c', strtotime("+1 hour"));
schedule = new Schedule();
`$schedule->scheduled_date = $dt

我确信我们缺少一些明显的东西,因此我们将不胜感激任何帮助。

最佳答案

我肯定会尝试将 DateTime 类 ( http://php.net/manual/en/class.datetime.php ) 与 DateTimeZone 结合使用,看看是否可以缓解问题。

我们还更新了日期/时间解析器以接受更多格式,这有望解决您在尝试使用 date('c')

时遇到的问题

如果您一直遇到问题,请告诉我!

谢谢,迈克

关于php - 持续联系 API 错误 :"Scheduled date is before the current time.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19859839/

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