Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
cancel
Showing results for 
Search instead for 
Did you mean: 

Date formatiing

SOLVED
Go to solution
Highlighted
Ali Imran Abbas
Regular Advisor

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
2 REPLIES
James R. Ferguson
Acclaimed Contributor
Solution

Re: Date formatiing

Hi:

See the manpages for 'date':

# date +%m/%d/%y

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

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

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