Last active
December 30, 2015 22:59
-
-
Save smullins7/7897520 to your computer and use it in GitHub Desktop.
Bash functions to convert to and from milliseconds since epoch UTC. Requires moment (http://momentjs.com/docs/) to be installed.
This file contains hidden or 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 millis { | |
| nvm use v0.10.12 > /dev/null && node -e "var m = require('moment'); console.log(+m.utc('${1}', ['MM/DD/YY', 'YYYYMMDDTHH:mm:ss']))" | |
| } | |
| function fmillis { | |
| nvm use v0.10.12 > /dev/null && node -e "var m = require('moment'); console.log(m(${1}).utc().format())" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Same functions in a source file. This won't work on OSX though, only linux. BSD bash has the somewhat-similar-but-different -f and -r flags though.