Skip to content

Instantly share code, notes, and snippets.

@johnantoni
Created April 28, 2009 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnantoni/103345 to your computer and use it in GitHub Desktop.
Save johnantoni/103345 to your computer and use it in GitHub Desktop.
function convertUKtoUSdate(ukDate) {
var tmpDate = ukDate;
if (tmpDate.indexOf(" ", 0) > 0) {
tmpDate = tmpDate.slice(0, tmpDate.indexOf(" ", 0) + 1);
}
var sl = tmpDate.length;
s1 = tmpDate.indexOf("/", 0);
var s2 = tmpDate.indexOf("/", s1 + 1);
var ukDate = tmpDate.slice(s1 + 1, s2) + "/" + tmpDate.slice(0, s1) + "/" + tmpDate.slice(s2 + 1, sl);
ukDate = new Date(ukDate);
return ukDate
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment