Clovertech
› Clovertech Forums › Read Only Archives › Cloverleaf › Tcl Library › How to convert a string into specific date format ?
How do we convert a string into specific date format ?
Input string:
20100628153744
Output should be
28-June-2010 03.37.44 PM
Pls help.?
Use the tcl clock command. clock has a format option.
-- Max Drown (Infor)
hcitcl>set dt 20100628153744
hcitcl>regsub — {(d{8})(d*)} $dt {1 2} dt
1
hcitcl>echo $dt
20100628 153744
hcitcl>clock format [clock scan $dt] -format “%d-%B-%Y %I.%M.%S %p”