Timestamp to date conversion in ksh

Hi,

I have a file containing timestamp( Example given below). How can i get date(mmd-dd-yyyy) from it?

($> cat file1.txt
2008-11-24 05:17:00.7043)

Thanks,
Sri

echo "2008-11-24 05:17:00.7043"| awk '{split($1,a,"-")} END{print a[2]"-"a[3]"-"a[1],$2}'
11-24-2008 05:17:00.7043

If you don't want the time, just strip out ",$2" of the print.

If your version of ksh is ksh93 ......

$ str=$(<file1.txt); printf "%(%m-%d-%Y %T)T.%s\n"  "$str" "${str: -4}"
11-24-2008 05:17:00.7043
$

or using %N microseconds

str=$(<file1.txt); printf "%(%m-%d-%Y %T.%4N)T\n"  "$str"
11-24-2008 05:17:00.7043
$

or

$ printf "%(%m-%d-%Y %T.%4N)T\n"  "$(<file1.txt)"
11-24-2008 05:17:00.7043
$