Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Get Current Unix TimeStamp Zulu MSScriptControl.ScriptControl VbScript DateDiff
;Winbatch 2011A - quick way to create Unix TimeStamp ; useful for filling SQLite Date Types ; Accounts for storing as GMT ;Stan Littlefield, June 9, 2011 ;/////////////////////////////////////////////////////////// #DefineFunction UnixTime(toGMT) ;if using ActiveX ;oS = CreateObject("MSScriptControl.ScriptControl") ;oS.Language = "VBScript" ;oS.AllowUI = @FALSE ;u=oS.Eval(: 'DateDiff("s", "01/01/1970 00:00:00", Now())') ;oS.Eval(: 'SetLocale(%l%)') ;oS = 0 ;using straight Winbatch u = TimeDiffSecs(TimeYmdHms(),"1970:01:01:00:00:00") If toGMT strComputer = "." oWMI = GetObject(StrCat("winmgmts:{impersonationLevel=impersonate}!\\",strComputer,"\root\cimv2")) oT = oWMI.ExecQuery("Select * from Win32_ComputerSystem") ForEach t In oT Time = t.CurrentTimeZone Next If Time<0 u=u+(Abs(Time)*60) Else u=u-(Time*60) EndIf EndIf Return(u) #EndFunction ;tests Message("","Current Unix TimeStamp":@CRLF:UnixTime(0)) Message("","Current Unix TimeStamp":@CRLF:UnixTime(1)) Exit
Article ID: W18172
Filename: Get Current Unix TimeStamp.txt
File Created: 2011:06:09:12:56:28
Last Updated: 2011:06:09:12:56:28