Let's Make It a Date
AnthonyEnglish 270000RKFN Visits (737)
In Australia, the UK, Canada, New Zealand and many other countries, we put the date in the format of dd/mm/yy. In other words, 11/12 means 11 December, not 12 November. So today, Wednesday 11 December 2013, we have these fantastic date and time combinations:
And then, exactly 3 hours 3 minutes and 3 seconds later:
Another 3:03:03 after that, if you swap the time and date fields, you get this:
Now if you want to display those dates and times using the AIX date command, it's pretty easy to do. First, with date you can specify a field using the % sign. Here are some extracts from the date command documentation:
So, to display that first and second time/date combination above, you'd need:
date +"%H:%M:%S %d/%m/%y"
And the third one just swaps the date and the time.
If you want to include that output as part of a log file, for example, you could do something like this:
echo $(date +"%d
Now how's that for a Geek party trick?
What about US?
And if you're based in the US or some other country which uses the format mm/dd/yy, don't feel as if you've missed out. You could have done all of these number patterns on 12 November 2013 and hopefully you'll still be alive in time for the next one of these magic dates.
On AIX you can customise dates and timestamps with the date command. For more about how to do this, read this article.