Date format question

I have a string that looks like this:

2008 04 09 18 45 30 0

I would like to convert it to a date format like this:

Wed Apr 09 18:45:30.000 GMT 2008

I have been searching all over and can't find anything to help me. I am using ksh on a sun solaris unix machine. Thank you.

Allyson

ksh93 is now available for Solaris (or you may be able to use dtksh which is part of CDE) and includes support for date string manipulation. I am not sure how you figure out the time zone or microseconds so I just hard coded these two items into the following example.

#!/usr/bin/ksh93

str="2008 04 09 18 45 30 0"
dstr=${str:0:10}
hstr=${str:11:8}

printf "%(%a %b %d %T.000 GMT %Y)T\n" "${dstr// /-} ${hstr// /:}"

outputs

Wed Apr 09 18:45:30.000 GMT 2008

hi,

what about this

Regards,
Bash