How to convert DATE to UNIX TIMESTAMP in shell script on MacOS
Solution 1:
date +%s
This works fine for me on OS X Lion.
Solution 2:
man date
on OSX has this example
date -j -f "%a %b %d %T %Z %Y" "`date`" "+%s"
Which I think does what you want.
You can use this for a specific date
date -j -f "%a %b %d %T %Z %Y" "Tue Sep 28 19:35:15 EDT 2010" "+%s"
Or use whatever format you want.