Skip to content

Instantly share code, notes, and snippets.

@imlucas
Created October 11, 2009 01:38
Show Gist options
  • Select an option

  • Save imlucas/207313 to your computer and use it in GitHub Desktop.

Select an option

Save imlucas/207313 to your computer and use it in GitHub Desktop.
// SAT, DAY MONTH YEAR TIME OFF
// (\w{3}+)(\,+) (\d{2}+) (\w{3}+) (\d{2}+) (\d{2}:\d{2}:\d{2}+) (\+|\-+)(\d{4}+)
// Comes in like this
// Sat, 10 Oct 09 00:43:06 +0000
// Needs to be
// Sat Oct 10 00:43:06 GMT+0000 2009
var cleaned:String = String(created).replace(/(\w{3}+)(.{1}+) (\d{2}+) (\w{3}+) (\d{2}+) (\d{2}:\d{2}:\d{2}+) (\+|\-+)(\d{4}+)/g, "$1 $4 $3 $6 GMT$7$8 20$5");
var then:Date = new Date();
then.setTime(Date.parse(cleaned));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment