ParoXsitiC Posted July 9, 2010 Posted July 9, 2010 I am using information from people using AutoIT, one of the bits of information I am using is the current time. It's my understanding that _NowCalc() returns the time according to the users timezone. Instead, I'd rather have it all based on whatever timezone is picked. Like for example if its 2:00PM in cali, id want it to say 5:00PM in the function, because that would be the EST time.
water Posted July 9, 2010 Posted July 9, 2010 (edited) You can use the following date/time functions. The example converts the local time to UTC but you can use _Date_Time_SystemTimeToTzSpecificLocalTime to convert UTC to any timezone you like. #include <date.au3> $tLT = _Date_Time_GetLocalTime() ConsoleWrite("Current local date/time .: " & _Date_Time_SystemTimeToDateTimeStr($tLT) & @CRLF) $tUTC = _Date_Time_TzSpecificLocalTimeToSystemTime(DllStructGetPtr($tLT)) ConsoleWrite("Current UTC date/time .: " & _Date_Time_SystemTimeToDateTimeStr($tUTC) & @CRLF) Edited July 9, 2010 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
ParoXsitiC Posted July 9, 2010 Author Posted July 9, 2010 (edited) The $pTimeZone [optional] Pointer to a $tagTIME_ZONE_INFORMATION structure that specifies the time zone of interest. If 0, the function uses the currently active time zone. has me confused. Whats an example of converting to eastern time? Is there any structure that has the common timezones done already? Also I wanted the results to be in YYYY/MM/DD HH:MM:SS Edited July 9, 2010 by ParoXsitiC
water Posted July 10, 2010 Posted July 10, 2010 Whats an example of converting to eastern time? Is there any structure that has the common timezones done already? Couldn't find an example on the forum but google delivered some good links: World Clock and the TimeZoneInformation Time zones information A script to extract the TZI information from the registry Also I wanted the results to be in YYYY/MM/DD HH:MM:SS Change the script to: #include <date.au3> $tLT = _Date_Time_GetLocalTime() ConsoleWrite]("Current local date/time .: " & _Date_Time_SystemTimeToDateTimeStr($tLT,1) & @CRLF) $tUTC = _Date_Time_TzSpecificLocalTimeToSystemTime(DllStructGetPtr($tLT)) ConsoleWrite("Current UTC date/time .: " & _Date_Time_SystemTimeToDateTimeStr($tUTC,1) & @CRLF) But please use at least AutoIt 3.6.6.0 for this to work. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now