Twitter Date format

256 views
Skip to first unread message

Xeoncross

unread,
Sep 25, 2008, 5:25:54 PM9/25/08
to Twitter Development Talk
What is the Date format that twitter uses? I don't know what a "HTTP-
formatted date" is - other than a time that is urlencode()'ed

I am trying work with PHP and I can't get it right - plus it looks
like there are two different types for XML and JSON...?

http://us2.php.net/manual/en/datetime.constants.php

date(DATE_RFC822, $timestamp); was the last one I tried.

Xeoncross

unread,
Sep 25, 2008, 4:06:00 PM9/25/08
to Twitter Development Talk
What is the Twitter date format now?

I am using PHP and have tried several types but I can't figure it out.
Plus it looks like there are two types of dates for XML and JSON....?

date(DATE_RFC822, $timestamp);

The docs say "HTTP-formatted date" - but what does that mean?

David Håsäther

unread,
Sep 26, 2008, 10:16:14 AM9/26/08
to Twitter Development Talk
On Sep 25, 11:25 pm, Xeoncross <Xeoncr...@gmail.com> wrote:
> What is the Date format that twitter uses? I don't know what a "HTTP-
> formatted date" is - other than a time that is urlencode()'ed

It seems to me that there are two different formats in use. The one
used by the "since" parameters in the API uses the RFC 1123 (updated
RFC 822) format, as seen in the examples.

The date format that is returned by the API is in another format
though, more similar to C's asctime() (as seen in <http://www.w3.org/
Protocols/rfc2616/rfc2616-sec3.html#sec3.3>).

I filed an issue in the tracker, see http://code.google.com/p/twitter-api/issues/detail?id=102

Alex Payne

unread,
Sep 26, 2008, 3:42:46 PM9/26/08
to twitter-deve...@googlegroups.com
Yes, there's a discrepancy in the dates. For the since parameters, we
accept RFC 1123 and whatever Ruby's Date.parse method can handle. For
dates in API responses, we output whatever Rails has decided is the
default. In the next version of the API this will be standardized for
both input and output. Apologies for the inconsistency in the
meantime.

--
Alex Payne - API Lead, Twitter, Inc.
http://twitter.com/al3x

Reply all
Reply to author
Forward
0 new messages