Date in bashPosted: September 16, 2013
Various uses of date function in bash.
Get current date as a string like “2013-09-16”:
Get yesterday’s date as a string like “2013-09-15”:
date -dyesterday +%Y-%m-%d
Get date as UNIX timestamp, convenient for scripts, can be converted to a normal date later: