Skip to content

Instantly share code, notes, and snippets.

@joshuaebowling
Last active May 4, 2016 19:37
Show Gist options
  • Save joshuaebowling/2bab849e9307bb3268ee1b3757dac2a0 to your computer and use it in GitHub Desktop.
Save joshuaebowling/2bab849e9307bb3268ee1b3757dac2a0 to your computer and use it in GitHub Desktop.
Parse javasscript date to OrientDB date format yyyy-MM-dd HH:mm:ss
/** parameters
//inDate example: Wed, 04 May 2016 19:25:26 GMT
//inMonth example: 4 (which would month number of May if during May you new Date().getMonth())
**/
var strTime, utcDate;
utcDate = inDate.split(' ');
arrTime = utcDate[4].split(':');
return [utcDate[3], ('0'+(parseInt(inMonth) + 1).toString()).slice(-2), utcDate[1], [arrTime[0], arrTime[1], arrTime[2]].join(':')].join(' ');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment