Thanks for the replies. I played around with Ruby 1.8.6 and date sent to Date.parse is now in the correct format:
URL string: http://twitter.com/direct_messages.xml?since=Mon27Oct2008 (No Urlencoding is needed as there are no special characters or spaces) Ruby Check: irb(main):037:0> d8 = Date.parse("Mon27Oct2008") => #<Date: 4909533/2,0,2299161> irb(main):038:0> d8.ctime() => "Mon Oct 27 00:00:00 2008" Note: It is useless providing a time (hr:min:sec) as Date class ignores this and outputs date in the above format. Perhaps Twitter documentation could be updated to mention this or the API can switch to using Ruby DateTime class. I see a http code 302 (page redirect) returned from twitter. The expected results should be all direct messages sent to the authenticating user after Mon Oct 27. It looks like Ruby is generating the correct date but the API does not recognize the format?perhaps an API bug. On 10/28/08, Alex Payne <[EMAIL PROTECTED]> wrote: > > Any format that Ruby 1.8.6's Date.parse method can comprehend will be > processed. > > On Tue, Oct 28, 2008 at 11:42 AM, krishnan chakravarthi > <[EMAIL PROTECTED]> wrote: > > > > I changed the date format and it made no difference. I am using PHP > > urlencode method as shown below: > > "direct_messages.xml?since=". urlencode(stripslashes(urldecode("Mon, > > 27 Oct 13:00:00 EST 2008"))); > > The date/time format is as specified in RFC822. > > > > The urlencoded string is output as: Mon%2C+27+Oct+13%3A00%3A00+EST+2008 > > > > Note: %3A is encoding format for : (colon) symbol. > > Twitter returns a 302 return code. > > > > Not sure why Date.parse(CGI.unescape()) mangles the date string as > > urldecode/encode and cgi.escape/unescape work the same way and > > Date.parse should accept RFC822 compliant dates. What Ruby version is > > installed in development environment? Is there a specific format in > > which API expects date/time, to work with Date.parse method. > > > > > > > > > > On 10/27/08, Alex Payne <[EMAIL PROTECTED]> wrote: > >> > >> Your date does not appear to be properly CGI-encoded: > >> > >> >> Date.parse(CGI.unescape("Sun%2C+26+Oct+22%3:55%3:48+000+2008")) > >> => Mon, 26 Oct 0022 > >> > >> That's what Ruby in our development environment thinks your date is. > >> Those "%3"s might be the culprit. > >> > >> On Mon, Oct 27, 2008 at 2:01 PM, Kris <[EMAIL PROTECTED]> wrote: > >> > > >> > I am aware of the example in the documentation. > >> > Thanks for pointing it out and I apologize for not mentioning before > >> > that I had tried the format listed in the documentation. > >> > > >> > For example: > >> > $this->twitterHost .= "direct_messages.xml?since=Sun%2C+26+Oct > >> > +22%3:55%3:48+000+2008"; > >> > results in error number 502 (server busy) and "Twitter is over > >> > capacity" message. > >> > Not sure why the API does not throw a format error? > >> > > >> > I saw a post (http://groups.google.com/group/twitter-development-talk/ > >> > browse_thread/thread/e97f02c8b8012fb5) which mentions that the API > >> > conforms to RFC1123 but that does not work either. > >> > > >> > Any thoughts? > >> > > >> > Thanks > >> > > >> > On Oct 27, 4:35 pm, "Damon Clinkscales" <[EMAIL PROTECTED]> wrote: > >> >> On Mon, Oct 27, 2008 at 1:48 PM, Kris <[EMAIL PROTECTED]> wrote: > >> >> > >> >> > The API documentation does not clearly list the date format for > >> >> > obtaining direct_messages sent to a user (within the specified date/ > >> >> > time window). > >> >> > I am using RFC 1123/822 format but do not get any messages sent with > >> >> > in the specified date/time window: > >> >> > >> >> > For Example: > >> >> > >> >> > direct_messages.xml?since=".urlencode("Sun, 26 Oct 2008 22:00:00 EST") > >> >> > >> >> > (does not return any messages or errors.) > >> >> > >> >> > What is the correct date/time format? Has anyone used this > >> >> > successfully? > >> >> > >> >> > Thanks > >> >> > >> >> Personally, I use since_id. > >> >> > >> >> But here's the > >> >> documentation:http://apiwiki.twitter.com/REST+API+Documentation#DirectMessageMethods > >> >> > >> >> which contains this example: > >> >> > >> >> # since. Optional. Narrows the resulting list of direct messages to > >> >> just those sent after the specified HTTP-formatted date, up to 24 > >> >> hours old. The same behavior is available by setting the > >> >> If-Modified-Since parameter in your HTTP request. > >> >> > >> >> Ex:http://twitter.com/direct_messages/sent.xml?since=Tue%2C+27+Mar+2007+... > >> >> > >> >> -damon > >> >> > >> >> --http://twitter.com/damon- Hide quoted text - > >> >> > >> >> - Show quoted text - > >> > > >> > >> > >> > >> -- > >> Alex Payne - API Lead, Twitter, Inc. > >> http://twitter.com/al3x > >> > > > > > > -- > Alex Payne - API Lead, Twitter, Inc. > http://twitter.com/al3x >
