Sign in to follow this  
Followers 0
graydwarf

Wrong date getting returned in _Date_Time_GetLocalTime() call.

5 posts in this topic

My local time is 11:02pm on 4/15/2012 but I'm getting back 04/16/2012. Any ideas?

Local $tDate = _Date_Time_GetLocalTime()
Return _Date_Time_SystemTimeToDateStr($tDate)

Share this post


Link to post
Share on other sites



I get the correct date/time when I run this reproducer script:

#include <Date.au3>
Local $tDate = _Date_Time_GetLocalTime()
ConsoleWrite(_Date_Time_SystemTimeToDateTimeStr($tDate) & @CRLF)

What version of AutoIt do you use?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

3.3.6.1

It's correct for most of the day but after 6pm (ish), it's giving me the next day.

Share this post


Link to post
Share on other sites

I get date / time in this format:

04/16/2012 19:54:42
What do you get?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

With this:

#include <Date.au3>
ConsoleWrite(Common_GetSystemDate() & @CRLF)
Func Common_GetSystemDate()
Local $tDate = _Date_Time_GetLocalTime()
Return _Date_Time_SystemTimeToDateStr($tDate)
EndFunc

I get this:

04/16/2012

+>12:28:51 AutoIT3.exe ended.rc:0

>Exit code: 0 Time: 1.523

I'm doubting myself now. I may not have saved my common.au3 file correctly so I could have been using GetSystemDate. When I first ran into the problem, I switched over to GetLocalDate but the problem remained. If I failed to save correctly, that could be the problem.

Guess I'll try the reduced repro this evening around 6pm and see what happens.

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  
Followers 0