Re: Date formatiing (35 Views)
Reply
Regular Advisor
Ali Imran Abbas
Posts: 152
Registered: ‎12-17-2007
Message 1 of 3 (35 Views)
Accepted Solution

Date formatiing

I want to print date in the formate mm/dd/yy. Is that possible with hpux. Actually I get a file every day on my server and the next day, this file is overwritten by the new file with the same name. I wanna keep the old files. I wanna rename each file by appending the date suffix to it. Can any body help me in that. please
Please use plain text.
Acclaimed Contributor
James R. Ferguson
Posts: 21,184
Registered: ‎07-06-2000
Message 2 of 3 (35 Views)

Re: Date formatiing

Hi:

See the manpages for 'date':

# date +%m/%d/%y

# mv myfile myfile.$(date +%m%d%y)

Regards!

...JRF...
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,888
Registered: ‎03-06-2006
Message 3 of 3 (35 Views)

Re: Date formatiing

>I want to print date in the formate mm/dd/yy.

(These are not the droids you are looking for. :-)
If you want this to sort right, you should use yy/mm/dd.
Or yyyy/mm/dd: date +%Y/%m/%d
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation