I believe that installing some GNU utilities with leading g on the utility names is an installation option on Solaris 10 systems. When I was using Solaris 10 systems, most of the systems at my location were installed without that option.
Except for the month in which the cal utility thinks the calendar switched from Julian dates to Gregorian dates (September 1752 in Great Britain and her colonies at that time), I think the following will do what you want on Solaris 10 systems when using bash, ksh, or /usr/xpg4/bin/sh as your shell for calendar years 1 through 9999:
If you invoke this script with the command:
where scriptname is the name of your script, it produces the output:
If your shell supports indexed arrays (which I think bash and ksh on Solaris 10 do, but I don't have access to them for testing), you could uncomment the lines in red and comment out the case statement shown in bold text and get the same results.
If you need to process dates in the month when the calendar changed from Julian dates to Gregorian dates, I will leave it as an exercise for the reader to fix the code for this corner case. Note that the output of cal 9 1752 on my system in the C Locale is:
Hello,
I want to convert MM DD YYYY date format to MM-DD-YYYY format.
For exemple:
I have to convert Nov 28 2005 to 28-11-2005.
Thenks for youf help.
DAFI (2 Replies)
Hi
I want to convert MAY 05 2005 01:15:00PM date format to 2005/05/05 01:15:00PM .
CAn somebody suggest me a code ,I am new to unix shell programming.
Thanks
Arif (21 Replies)
Hi,
I have the string YYYYMMDDHHMMSS like 20090801204150 and I need to convert it using the unix command date in the format:
date "Saturday, 1 August 2009 20:40:59"
All in one single Unix line if this is possible. What's the correct syntax?
Steve Hagi (6 Replies)
Hi all,
I require to convert julian date to normal calander date in unix
for eg julian date=122
now i want corresponding calander date
----------------------------------------
gr8 if give very small command/script
and please explain the steps as well(imp)
Thanks
... (3 Replies)
Trying to convert dates using a Perl Script but it has to accept formats like
3 letter month, day and year like Nov 02 2010 or 1/4/11 or 21 Feb 2011 and have it convert to something like October 20, 2011. Any ideas? (2 Replies)