So simple and so useful. If you have a lot of data with ‘unusual’ date stamps, you can easily convert them to ISO compliant Calendar Date format using the built in UNIX date command.
-j tells the system not to try to set the date, but to look for input from the -f flag
-f denotes that you’re going to specify the input format of the date you’re trying to convert
Then you need to describe the input format. The Wikipedia page on the the UNIX date command has all of the details on the different representations of year, month, day, weeks, etc.
Here are some samples:
date -jf “%m_%d_%y” 2_29_12 “+%Y-%m-%d”
date -jf “%y%m%d” 120402 “+%Y-%m-%d”
date -jf “%y/%m/%d” 12/4/2 “+%Y-%m-%d”
date -jf “%m_%d_%y” 2_29_12 “+%Y-%m-%d”