Page 1 of 1

Data() is works correctly?

Posted: Fri Dec 16, 2016 8:47 am
by bizdon
PB 4.4-5.3 and higher, W7_x23/x64
1. this code:

Code: Select all

BufferSize=255 
RegOpenKeyEx_(#HKEY_LOCAL_MACHINE,"SOFTWARE\Microsoft\Windows NT\CurrentVersion",0,#KEY_QUERY_VALUE+256,@Key)
RegQueryValueEx_(Key, "InstallDate", 0, @Type, @Buffer, @BufferSize) 
RegCloseKey_(Key)
MessageBox_(0,FormatDate("%dd.%mm.%yyyy,  %hh:%ii:%ss", Buffer),"Windows_installed",0)
displays the time of installation of Windows (in variable 'Buffer' the time in seconds from 1.1.1970, 0:00:00)
However, the setting time is obtained in other ways:
2. C:\Windows\System32\wbem\Wmic.exe os get installdate /Value
3. C:\Windows\System32\Systeminfo.exe
more obtained in point 1 to 3 hours. Is it right or Data() underestimates the value of 3 hours?

Re: Data() is works correctly?

Posted: Fri Dec 16, 2016 9:30 am
by Keya
so by Data() you mean FormatDate(), no i don't think there'd be any problem with that

but you might need to convert it from Unixtime UTC or to LocalTime first, ie https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
I dont have any code at hand sorry but plenty of other coders have tackled the problem over the years so you might find some ideas/code with this search https://www.google.com/search?q=%22Curr ... +%22UTC%22

Re: Data() is works correctly?

Posted: Fri Dec 16, 2016 10:25 am
by bizdon
Keya
Thank you!