;------------------------------------------------------------------------------------------------------------------------------------------ #DefineFunction udfFormatDateTime (strYmdHms, intMode) intMode = Min (Max (intMode, 0), 4) strDT = StrReplace (StrSub (strYmdHms, 1, 10), ":", "/") : " " : StrSub (strYmdHms, 12, -1) objVB = ObjectCreate ("MSScriptControl.ScriptControl") objVB.Language = "VBScript" strDT = objVB.Eval(: 'FormatDateTime(CDate("' : strDT : '"),' : intMode : ')') ; 0: 2012-05-24 19:27:05 (system set to ISO 8601) objVB = 0 Return strDT ;.......................................................................................................................................... ; This UDF "udfFormatDateTime" converts a given WinBatch DateTime string into other human readable formats, ; using the VBScript function "FormatDateTime". ; ; Parameters: ; strYmdHms ... A WinBatch DateTime string of format "YYYY:MM:DD:HH:MM:SS", e. g. "2012:05:25:13:04:16". ; intMode ... 0 "2012-05-24 19:27:05 (if system set to ISO 8601)" ; 1 "Donnerstag, 24. Mai 2012" (german language) ; 2 "2012-05-24" ; 3 "19:27:05" ; 4 "19:27" ; ; (c)Detlev Dalitz.20120525. ;.......................................................................................................................................... #EndFunction ;------------------------------------------------------------------------------------------------------------------------------------------ ; Test. strYmdHms = TimeYmdHms () strDT0 = udfFormatDateTime (strYmdHms, 0) ; 0: 2012-05-24 19:27:05 (if system set to ISO 8601) strDT1 = udfFormatDateTime (strYmdHms, 1) ; 1: Donnerstag, 24. Mai 2012 (german language) strDT2 = udfFormatDateTime (strYmdHms, 2) ; 2: 2012-05-24 strDT3 = udfFormatDateTime (strYmdHms, 3) ; 3: 19:27:05 strDT4 = udfFormatDateTime (strYmdHms, 4) ; 4: 19:27 strMsgTitle = strYmdHms strMsgText = strDT0 : @LF : strDT1 : @LF : strDT2 : @LF : strDT3 : @LF : strDT4 Message (strMsgTitle, strMsgText) :CANCEL Exit