Originally posted by Ricci Graham
I have written the following code inside my Xlate to reformat the the date
from YYYYMMDDhhmmss to MMDDYYYY.
CODE INSIDE XLATE:lassign $xlateInVals dt
set dtcter 0
set dtcter [string length $dt]
if {$dtcter < 5} {
set dtcter 0
} else {
regsub -- {(d{8})(d*)} $dt {1 2} dt
set dt [clock format [clock scan $dt] -format "%m%d%Y"]
set xlateOutVals
set dtcter 0}My problem is when the date field contains only four digits in the time (i.e. 200703250028) then it raises the following error:
ERROR:Tcl callout error
erroCode: NONE
errorInfo:
unable to convert date-time string "20070325 0028"
while executing
"clock scan $dt"
invoked from within
"if {$dtcter < 5} {
set dtcter 0
} else {
regsub -- {(d{8})(d*)} $dt {1 2} dt
set dt [clock format [clock scan $dt] -format "%m%d%Y"]
set x..."
<End of errorInfo>
It also raises an error if the field contains something like 99999999 or
00000000.
How can I get around these issues?
Any ideas or suggestions will be greatly appreciated.
Thanks,
Ricci