Hi ,
I want the date in the following format(Solaris platform)
CCYYMMDD:HHSS
I am facing problems in extracting century from the date.
I tried the following options.
`date '+%cc%y%m%d:%H%S`
but the Output is (Thu Feb 09 02:28:21 2006c060209:0221).
I think this problem is specific to solaris platform.
I kindly request your help in resolving this issue.
Thanks & Regs
Anand
Try:
$ date '+%Y%m%d:%H%S'
20060209:1252
Note that I have a single quote before and after the argument to date. You only have a single quote before the argument. You're getting away with that because the whole date command is enclosed in back quotes. The result you get with your date command is correct and HP-UX gives the same result.
Using HHSS is really odd. Most of us would stick the minutes in there too. But I guess it's your script.