Google Calendar API date time(谷歌日历 API 日期时间)
问题描述
我正在尝试让 Google Calendar Api 正常工作.如果不使用我的 $_POST 日期时间,它就可以完美运行.但是然后日期像谷歌一样被硬编码,这不是我想要的.当我使用我的 $_POST 变量时,它向我显示了这个错误:
I'm trying to get the Google Calendar Api to work. Without the use of my $_POST date times it works perfect. But then the date is hard coded like the google ones and that is not what i want. When i use my $_POST vars it shows me this error:
我的日期时间代码:
我也在试验 echo $dt->format("c") ."
";
这只是在没有 .000 的情况下给了我同样的东西.Google 日历要求我使用一角钱的时间格式,例如:
I'm also experimenting with echo $dt->format("c") . "
";
which is giving me the same thing only without .000 .
Google Calendar requires me to have a dime time format like:
来源:用 PHP 创建简单的 Google 日历事件
我的 HTML 输入字段:
My HTML input fields:
ATM 我没有使用我的 $_POST 我正在检查
ATM i'm not using my $_POST i'm checking with
所以我的问题是,我如何使用 PHP 获得谷歌时间格式?
So my question is, How do i get the google time format with PHP?
谢谢
推荐答案
查看 Google 日历 API 文档 所需格式必须遵循 RFC 3339 格式.要将 DateTime
转换为这种格式,可以使用 DateTime::format 函数与 DateTime::RFC3339 常量.
Looking at the Google Calendar API docs the required format must follow the RFC 3339 format. To convert a DateTime
to this format one can use the DateTime::format function in conjunction with the DateTime::RFC3339 constant.
你应该得到类似的东西:
You should get something like:
这篇关于谷歌日历 API 日期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!