perl -MPOSIX -le'print strftime "%x %X", localtime time'
07/06/05 17:05:49
There are many more formatting options, have a look at the strftime docs
Update
Sorry did not read the OP too closely, he wants AM or PM so this may be more like it ...
perl -MPOSIX -le'print strftime "%r %x", localtime time'
06:47:16 PM 07/07/05
Cheers, R.
Pereant, qui ante nos nostra dixerunt!
|