Skip to content

Instantly share code, notes, and snippets.

@boriscy
Created March 12, 2014 20:59
Show Gist options
  • Save boriscy/9516206 to your computer and use it in GitHub Desktop.
Save boriscy/9516206 to your computer and use it in GitHub Desktop.
parseDateDB = function(d) {
arr = d.split('-')
y = arr[0]
m = arr[1] * 1 - 1
d = arr[2]
try {
return new Date(y, m, d)
} catch (e)
return new Date()
}
}
@boriscy
Copy link
Author

boriscy commented Mar 12, 2014

Inside mongo:
> load("parsedate.js");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment