Data() is works correctly?

Just starting out? Need help? Post your questions and find answers here.
bizdon
User
User
Posts: 12
Joined: Wed Jun 22, 2011 6:49 pm

Data() is works correctly?

Post 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?
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: Data() is works correctly?

Post 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
bizdon
User
User
Posts: 12
Joined: Wed Jun 22, 2011 6:49 pm

Re: Data() is works correctly?

Post by bizdon »

Keya
Thank you!
Post Reply