Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Adjust Convert Current Time Zone UTC YMDHMS
#DefineFunction HexByteToDec(_sHexByte) _sHexByte = StrUpper(_sHexByte) nHexOff = 55 nByte = 0 For i = 1 To 2 cNybble = StrSub(_sHexByte,i,1) If !IsInt(cNybble) Then cNybble = Char2Num(cNybble) - nHexOff nByte = (nByte << 4) | cNybble Next Return nByte #EndFunction #DefineFunction Hex2Date(Hex) aH = Arrayize(Hex," ") If ArrInfo(aH,1)<8 Then Return "" aD = ArrDimension(8) For i = 0 To 7 aD[i] = HexByteToDec(aH[i]) * 1.0 Next Term = aD[7] * (2.0**56) + aD[6] * (2.0**48) + aD[5] * (2.0**40) + aD[4] * (2.0**32) + aD[3] * (2.0**24) + aD[2] * (2.0**16) + aD[1] * (2.0**8) + aD[0] Days = Term / (1E7 * 86400) fDate = 0.0 + ObjectType("DATE",Days) + ObjectType("DATE","1601/01/01") Return ObjectType("DATE",fDate) #EndFunction ; Needs some work but conveys the general idea... #DefineFunction TimeAdjustCurrentZone(strUtcTime) nActiveBias = RegQueryDword(@REGMACHINE,"SYSTEM\CurrentControlSet\Control\TimeZoneInformation[ActiveTimeBias]", 0) If nActiveBias >= 0 Return TimeSubtract(strUtcTime,"0000:00:00:00:":nActiveBias:":00") Else Return TimeAdd(strUtcTime,"0000:00:00:00:":Abs(nActiveBias):":00") #EndFunction ; Test RegShutdownTime = RegQueryBin(@REGMACHINE,"System\CurrentControlSet\Control\Windows[ShutdownTime]"); Sample '04 8B DA 6D 2B A4 C9 01' ShutDownTime = Hex2Date(RegShutdownTime) ShutDownTime = TimeAdjustCurrentZone(ObjectType("DATE", ShutDownTime)) Message("",ShutDownTime:" GMT") Exit
Article ID: W18407
Filename: TimeAdjustCurrentZone.txt
File Created: 2009:03:16:09:17:36
Last Updated: 2009:03:16:09:17:36