问题描述
无效的值为: T发现,只能解析裸露的日期字符串:2013-08-22T16:00:00
我也尝试将时区偏移量添加到我的字符串中,但我手动设置了EventDateTime对象中的时区,并根据文档确定它不是必需的。
以下是我如何创建我的时间字符串:
data ['start'] = $(#inputDateStart)。val()+T+ $( #inputTimeStart)VAL()。
以及如何在此对象中设置此字符串
$ start = new Google_EventDateTime();
$ start-> setTimeZone('America / Montreal');
$ start-> setDateTime($ data ['start']);
$ event-> setStart($ start);
我错过了什么?
我不知道你的整个代码,但我不知道你的整个代码,但我在尝试在Google日历事件中设置日期时间时收到相同的错误消息。当我使用Google在线API检查器时,我使用的日期/时间格式和时区工作得很好。最后,我发现问题是因为我做了这个(使用类似于你的符号的东西):
$ start =新的Google_EventDateTime();
$ start-> setDate('2013-10-10');
$ event-> setStart($ start);
然后在找到我有日期和时间数据后:
$ start-> setTimeZone('Europe / London');
$ start-> setDateTime('2013-10-10T19:15:00');
$ event-> setStart($ start);
这给了我你提到的错误信息。也许谷歌解析器认为这只是一个日常事件,然后被更多的日期/时间数据混淆。
当我先检查是否同时存在日期和时间数据时,问题就消失了:
$ start =新的Google_EventDateTime();
$ start-> setTimeZone('Europe / London');
$ start-> setDateTime('2013-10-10T19:15:00');
$ event-> setStart($ start);
I'm trying to create an event for Google Calendar and I'm getting this error :
Invalid value for: "T" found, can only parse bare date string: 2013-08-22T16:00:00
I also tried adding the timezone offset to my string but I set the timezone manually in the EventDateTime object and according to the documentation it's not neccesary.
Here is how I create my time string :
data['start'] = $("#inputDateStart").val() + "T" + $("#inputTimeStart").val();
And how I set this string in my object
$start = new Google_EventDateTime();
$start->setTimeZone('America/Montreal');
$start->setDateTime($data['start']);
$event->setStart($start);
What am I missing? All day events work fine when I just set my date using the setDate function.
I dont know your whole code, but I was getting the same error message when trying to set a date-time on a Google calendar event. When I used the Google online api checker, the date/time format and timezone I was using worked just fine. In the end I found that the problem was because I had done this (using something similar to your notation):
$start = new Google_EventDateTime();
$start->setDate('2013-10-10');
$event->setStart($start);
And then later after finding I had both date and time data available:
$start->setTimeZone('Europe/London');
$start->setDateTime('2013-10-10T19:15:00');
$event->setStart($start);
This gave me the error message you mention. Maybe the Google parser thought it was a day event only and then was confused by additional date/time data.The problem went away when I checked first if I had both date and time data and just did:
$start = new Google_EventDateTime();
$start->setTimeZone('Europe/London');
$start->setDateTime('2013-10-10T19:15:00');
$event->setStart($start);
这篇关于Google日历事件的正确日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!