Try looking at the man page for your implementation of the date command.
On a Linux system, you can get (for example) the number of seconds from the epoch like this:
Or if you want the date yesterday in YYYYMMDD format, you can do this:
Code:
date --date="1 day ago" +%Y%m%d
Note: the --date option is specific to GNU date, as far as I know, and is not portable...
If you have any other questions about date handling, please respond, as I have been doing a
lot of tedious date juggling in scripts lately.
If you do reply, please include your operating system (available via the
uname -a command), and if possible, which "date" you are using. Also, please give examples of which formats you are converting from, and the expected output.