Jump to content
Sign in to follow this  
ParoXsitiC

Default Timezone for NowCalc

Recommended Posts

ParoXsitiC

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.

Share this post


Link to post
Share on other sites
water

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 by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
ParoXsitiC

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 by ParoXsitiC

Share this post


Link to post
Share on other sites
water

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 (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×