I am trying to convert a timestamp to a number of seconds and it is not working as intended on a mac. On linux I can run:
date -d "2015-06-11 12:39" +%s
and I get 1434044340
as intended. However, when I run that same command on a mac, I get
usage: date [-jnu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
what is the corresponding mac command and/or how can I get the original command to work on a mac?
3 years later :)
Try this:
brew install coreutils ; echo "alias date=gdate" >> ~/.bash_profile
Then run your command
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With