Jump to content
Sign in to follow this  
graydwarf

Wrong date getting returned in _Date_Time_GetLocalTime() call.

Recommended Posts

graydwarf

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
water

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 (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
graydwarf

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
water

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 (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
graydwarf

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  

×