Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
#DefineFunction udfConvertTimeDate( ts, format ) YYYY = ItemExtract(1, ts, ":") YY = StrSub(YYYY, 3, 2) MM = ItemExtract(2, ts, ":") DD = ItemExtract(3, ts, ":") HH = ItemExtract(4, ts, ":") NN = ItemExtract(5, ts, ":") SS = ItemExtract(6, ts, ":") NewFormat = format If StrIndex(format, "YYYY", 0, @FWDSCAN) Then NewFormat = StrReplace(NewFormat, "YYYY", YYYY) End If If StrIndex(format, "YY", 0, @FWDSCAN) Then NewFormat = StrReplace(NewFormat, "YY", YY) End If If StrIndex(format, "MM", 0, @FWDSCAN) Then NewFormat = StrReplace(NewFormat, "MM", MM) End If If StrIndex(format, "DD", 0, @FWDSCAN) Then NewFormat = StrReplace(NewFormat, "DD", DD) End If If StrIndex(format, "HH", 0, @FWDSCAN) Then NewFormat = StrReplace(NewFormat, "HH", HH) End If If StrIndex(format, "NN", 0, @FWDSCAN) Then NewFormat = StrReplace(NewFormat, "NN", NN) End If If StrIndex(format, "SS", 0, @FWDSCAN) Then NewFormat = StrReplace(NewFormat, "SS", SS) End If Return NewFormat #EndFunction #DefineFunction udfConvertTimeDateToYmdHms ( ts, format ) iYYYY = StrIndex(format, "YYYY", 1, @FWDSCAN) YYYY = StrSub(ts, iYYYY, 4) If iYYYY == "0" Then iYY = StrIndex(format, "YY", 1, @FWDSCAN) YY = StrSub(ts, iYY, 2) If YY < 80 Then YYYY = (2000 + YY) Else YYYY = (1900 + YY) End If End If iMM = StrIndex(format, "MM", 1, @FWDSCAN) MM = StrSub(ts, iMM, 2) iDD = StrIndex(format, "DD", 1, @FWDSCAN) DD = StrSub(ts, iDD, 2) iHH = StrIndex(format, "HH", 1, @FWDSCAN) HH = StrSub(ts, iHH, 2) iNN = StrIndex(format, "NN", 1, @FWDSCAN) NN = StrSub(ts, iNN, 2) iSS = StrIndex(format, "SS", 1, @FWDSCAN) SS = StrSub(ts, iSS, 2) ;YYYY:MM:DD:HH:MM:SS NewFormat = StrCat(YYYY, ":", MM, ":", DD, ":", HH, ":", NN, ":", SS) Return NewFormat #EndFunction
Article ID: W16222
File Created: 2004:03:30:15:43:28
Last Updated: 2004:03:30:15:43:28