Created
August 19, 2013 20:28
-
-
Save onel0p3z/6273719 to your computer and use it in GitHub Desktop.
Date helpers functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function SendDate(date){ | |
// Expecting date as string like '2013-08-08' | |
var temp; | |
date = date.split('-'); | |
temp = new Date(date); | |
// Returns '2013-08-19T04:00:00.000Z' | |
return temp.toISOString(); | |
} | |
function ReceiveDate(date){ | |
// Expecting date like ISODate('2013-08-19T04:00:00.000Z') | |
var temp; | |
date = new Date(date); | |
temp = date.getFullYear()+''+(date.getMonth()+1)+''+date.getDate(); | |
// Returns '2013-08-19' | |
return temp; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment