On Nov 16, 2:51 pm, Stephen Wells <
stephen.we...@guardian.co.uk>
wrote:
> We have released build 524 of the content api tohttp://
content.guardianapis.com. This includes the following changes:
> ...
>
> *from-date and to-date support time:*
> ...
Just to clarify this a little, as date and date time handling always
seems to cause confusion.
The content API always reports dates in ISO 8601 format, normalised to
our local timezone here in London, UK. So they normally end in "Z" in
winter time (when we're on GMT/UTC) and end in "+01:00" in summer time
when we're on UTC+1. This is true both for XML and json.
The from-date and to-date parameters support either just a date or a
date and time (with optional time zone).
1. If you specify just a date (e.g. 2010-07-20) this is interpreted as
"midnight london local time at the start of 2010-07-20" for the from-
date, and for the to-date as "one millisecond before midnight london
local time at the start of 2010-07-21".
2. If you specify a date and time without any timezone information (as
in Stephen's example 2010-10-15T14:00:00) this is interpreted as
london local time, in this case 2pm UTC. Note that when summer time
applies in the UK, times specified like this are interpreted as UTC+1.
So 2010-07-20T14:00:00 means 1pm UTC.
3. To avoid any confusion, specify the date and time with a time zone
in standard ISO 8601 format, i.e. Z (for UTC) or +/-HH:MM. You can
specify this in your local time zone, which we should convert
correctly. Note that dates and times in responses are always uk time
zone based, as noted above. (NB: if you're hacking the url in your
browser, remember that it will interpret "+" as a space, use "%2B"
instead.) So a from-date=2010-07-20T01:00:00-08:00&order-by=oldest
representing 1am PST on 20 July 2010 returns content with a web
publication date of 2010-07-20T10:00:44+01:00 as its first result -
the first item after 9am UTC (or 10am British Summer Time which is UTC
+1).
Hope this helps. Please post to this list if it doesn't seem to be
working correctly for you.
Oh, and I notice we haven't updated the api explorer yet to support
date-times for these fields, sorry, we'll try to do this in the next
few days.
Cheers
g
[1]
http://en.wikipedia.org/wiki/ISO_8601