I would suggest using a regsub to format the date into a format that can be scanned. If the hour happens to be ’00’, you’ll get an error when trying to format it without the colon between the hours and minutes (and seconds, if included).
hcitcl> set date “201001111357”
hcitcl> regsub — {(d{8})(d{2})(d{2})} $date {1 2:3} newDate
1
hcitcl> puts $newDate
20100111 13:57
hcitcl> clock format [clock scan $newDate] -f {%m/%d/%Y %l:%M %p}
01/11/2010 1:57 PM
Here’s an example of a date that would fail without the colon between the hours and minutes:
hcitcl>set newDate “20100111 0056”
20100111 0056
hcitcl>clock format [clock scan $newDate] -f {%m/%d/%Y %l:%M %p}
Error: unable to convert date-time string “20100111 0056”
hcitcl>set newDate “20100111 00:56”
20100111 00:56
hcitcl>clock format [clock scan $newDate] -f {%m/%d/%Y %l:%M %p}
01/11/2010 12:56 AM
This is a bug in the clock command.
Hope this helps.
Steve