Mar 14, 2013

Convert Twitter's created_at to Javascript Date

Posted Mar 14, 2013
There are several solutions found on the web to parse Twitter's date, but some seems outdated, maybe Twitter changed its date format. But as of March 2013, the code below works:

function parseTwitterDate(aDate)
{   
  return new Date(Date.parse(aDate.replace(/( \+)/, ' UTC$1')));
  //sample: Wed Mar 13 09:06:07 +0000 2013 
}

Source 

2 comments:

  1. How would I made it look like a nice looking format?

    ReplyDelete
  2. Thanks. It saved my time!

    ReplyDelete