开发者

google calendar api start-min/start-max not returning proper values

开发者 https://www.devze.com 2023-02-09 03:47 出处:网络
i\'m querying google calendar api to bring back dates between the start-min and start-max dates that i provide. however, in doing so, i am getting dates that shouldn\'t be returned. the calendar i\'m

i'm querying google calendar api to bring back dates between the start-min and start-max dates that i provide. however, in doing so, i am getting dates that shouldn't be returned. the calendar i'm accessing has plenty of dates in between january and february, but it returns dates in 2010, and dates outside of jan/feb. here is my string

i replaced the calendar location w/ the demo one. when doing this, i use my public calendar link

http://www.google.com/calendar/feeds/developer-calendar@google.com/public/full?alt=json&singleevents=true&sortorder=ascending&start-min2011-1-01T00:00:00%20&start-max2011-2-20T23:59:59

here are the dates i'm getting back.

[INFO] starttime = 2010-01-09T00:00:00.000Z end time = 2010-01-09T02:00:00.000Z
[INFO] starttime = 2010-01-07T21:00:00.000Z end time = 2010-01-07T22:00:00.000Z
[INFO] starttime = 2010-01-12T00:30:00.000Z end time = 2010-01-12T02:30:00.000Z
[INFO] starttime = 2010-01-09T20:00:00.000Z end time = 2010-01-09T20:45:00.000Z
[INFO] starttime = 2010-01-16T20:00:00.000Z end time = 2010-01-16T21:30:00.000Z
[INFO] starttime = 2010-01-16T16:00:00.000Z end time = 2010-01-16T17:30:00.000Z
[INFO] starttime = 2010-01-14T00:30:00.000Z end time = 2010-01-14T01:15:00.000Z
[INFO] starttime = 2010-01-09T23:00:00.000Z end time = 2010-01-10T02:00:00.000Z
[INFO] starttime = 2010-01-16T21:00:00.000Z end time = 2010-01-16T22:00:00.000Z
[INFO] starttime = 2010-01-10T20:00:00.000Z end time = 2010-01-10T21:00:00.000Z
[INFO] starttime = 2010-01-14T22:00:00.000Z end time = 2010-01-14T23:00:00.000Z
[INFO] star开发者_开发技巧ttime = 2010-01-12T00:30:00.000Z end time = 2010-01-12T01:00:00.000Z
[INFO] starttime = 2010-01-11T16:30:00.000Z end time = 2010-01-11T17:00:00.000Z
[INFO] starttime = 2010-01-16T20:00:00.000Z end time = 2010-01-16T20:45:00.000Z
[INFO] starttime = 2010-01-12T16:00:00.000Z end time = 2010-01-12T16:30:00.000Z
[INFO] starttime = 2010-01-21T21:00:00.000Z end time = 2010-01-21T22:00:00.000Z
[INFO] starttime = 2010-04-22T20:30:00.000Z end time = 2010-04-22T21:15:00.000Z
[INFO] starttime = 2010-04-03T14:30:00.000Z end time = 2010-04-03T17:00:00.000Z
[INFO] starttime = 2010-03-25T20:00:00.000Z end time = 2010-03-25T22:00:00.000Z
[INFO] starttime = 2010-04-23T15:30:00.000Z end time = 2010-04-23T16:00:00.000Z
[INFO] starttime = 2010-02-03T22:00:00.000Z end time = 2010-02-03T23:00:00.000Z
[INFO] starttime = 2010-05-01T19:00:00.000Z end time = 2010-05-01T21:00:00.000Z
[INFO] starttime = 2010-02-13T23:00:00.000Z end time = 2010-02-14T02:00:00.000Z 
[INFO] starttime = 2010-04-30T21:00:00.000Z end time = 2010-04-30T22:30:00.000Z
[INFO] starttime = 2010-03-07T19:00:00.000Z end time = 2010-03-07T20:30:00.000Z

google api reference: http://code.google.com/apis/calendar/data/2.0/reference.html#Parameters


The biggest problem here appears to be in your GET syntax. You have keys and values, but no assignment character. In other words, you need equal signs.

Also, you need leading 0s and to remove that pesky %20.

Try this:

http://www.google.com/calendar/feeds/developer-calendar@google.com/public/full?alt=json&singleevents=true&sortorder=ascending&start-min=2011-01-01T00:00:00&start-max=2011-02-20T23:59:59


In the URL you posted, you have (extracted):

start-min2011-1-01T00:00:00%20&start-max2011-2-20T23:59:59

That should really be:

start-min=2011-01-01T00:00:00&start-max=2011-02-21T00:00:00

You're missing "=" characters, and the month values should be 2-digit numbers. The "start-max" value is exclusive, which is convenient because you don't have to do that "23:59:59" stuff; just use midnight of the following day.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号