Get timestamp in milliseconds


echo $(($(date +%s%N)/1000000))

in Mac OS X, the command date does not support the %N flag, we can install coreutils using homebrew.

brew install coreutils

Then use gdate to get which we want.

echo $(($(gdate +%s%N)/1000000))

This entry was posted in Linux, Mac. Bookmark the permalink.