Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
date format in ksh
Name: cesar_NZ Date: October 7, 2008 at 15:17:03 Pacific OS: solaris CPU/Ram: na Product: na
Comment:
hi all, am trying to get today's date in the following format :
m/d/yy i.e
single digit for month unless its a double digit (8 rather than 08), single digit for day unless its a double digit and double digit for year.
have tried 'date +%m/%d/%y' but it keeps giving me double digits where not needed i.e 10/08/08
Name: Razor2.3 Date: October 7, 2008 at 19:06:48 Pacific
Reply:
Try:
$((`date +%m`))/$((`date +%d`))/`date +%y`
0
Response Number 2
Name: cesar_NZ Date: October 7, 2008 at 19:46:39 Pacific
Reply:
thanks for the reply, but it didnt work. date +%d give double digits. have tried date "+%Om/%Oe/%y" but that has a space in number of days which is not what i wanted e.g 10/ 8/08
0
Response Number 3
Name: Razor2.3 Date: October 7, 2008 at 20:28:29 Pacific
Reply:
date +%d give double digits Right, but on my platform, that gets rid of the preceding '0.' If you didn't try it with the $((` `)), then try it.
0
Response Number 4
Name: cesar_NZ Date: October 8, 2008 at 15:27:41 Pacific
Reply:
hi, yap i did try that but it didnt work. must be specific to my platform.
thanks anyway.
0
Response Number 5
Name: cesar_NZ Date: October 8, 2008 at 17:31:04 Pacific
Reply:
dont know why i didnt think of this before, heres the solution :
Summary: The system default short date format is: dd-MM-yyyy. We have an application that runs with the date format in: dd/MM/yyyy. Is there any method (e.g. batch) so that we can change the date format tempo...
Summary: First, Excuse me for my English, it is very bad. I know I can choose date format in Control Panel. But only shows dd/mm/yyyy format in ms-dos, I can not change it. I try to explain me better. I am do...