Skip to content

Instantly share code, notes, and snippets.

@lemanchester
Last active August 29, 2015 13:57
Show Gist options
  • Save lemanchester/9772186 to your computer and use it in GitHub Desktop.
Save lemanchester/9772186 to your computer and use it in GitHub Desktop.
DateTime Ruby to Javascript - WTF?
Ruby:
DateTime.parse("2013-08-01 00:00:00").utc.to_i*1000
1375315200000
Javascript:
alert(d3.time.format('%m/%d/%Y')(new Date(1375315200000)))
Result
07/31/2013
Ruby:
DateTime.parse("2013-08-01 00:00:00").strftime("%Q")
"1375315200000"
Result
07/31/2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment