Format date and time for script
I have developed a script that I am going to use to backup my database regularly. I would like to save the database with a unique filename each time, using the date and time. The filename is already long to begin with, so I am trying to have the most compact date and time possible. I can't find any simple way to format a date+time string to my liking.
All I would like to do is something like this: 20130411110512 (Year,Month,Day,Hour,Min,Sec)
This is simple on a *nix system: date "+%Y%m%d%H%M%S"
Formatting like this has been around since... forever. How can this be so hard? Am I missing something here?