Page 1 of 1

Windows: Set file / folder date to the _correct_ time (regardless of daylightsavingtime)?

Posted: Sun Apr 02, 2023 8:07 pm
by jacky
Hi!

I'd like to set a file / folder dates (modified / created / accessed) to a specific time that is not shifted by the bias of daylightsavingtime...

E.g. if I use this function from the german forum: https://www.purebasic.fr/german/viewtop ... 624#p71624

with:

Code: Select all

#Day = 15
#Month = 3
#Year = 2023
#Hour = 8
#Minute = 00
Then the modified time (which is outside of the current daylightsavingtime) of the file is not 08:00 but 07:00...

Is there a (simple) way to do this (that works regardless of where you live in the world)?

Sorry, all that time conversation stuff is a little bit over my head :oops:

Re: Windows: Set file / folder date to the _correct_ time (regardless of daylightsavingtime)?

Posted: Sun Apr 02, 2023 10:02 pm
by mk-soft
UTC

Re: Windows: Set file / folder date to the _correct_ time (regardless of daylightsavingtime)?

Posted: Sun Apr 02, 2023 10:19 pm
by highend
That code converts to UTC but the time is (still) wrong?

Code: Select all

LocalFileTimeToFileTime_(@LocalFileTime, @UTCFileTime)

Re: Windows: Set file / folder date to the _correct_ time (regardless of daylightsavingtime)?

Posted: Mon Apr 03, 2023 12:57 am
by idle

Code: Select all

ImportC "" 
   DATE_UTC(t=0) As "time"  
EndImport 
 
Debug FormatDate("%dd/%mm/%yyyy %hh:%ii:%ss", Date_UTC()) 
Debug FormatDate("%dd/%mm/%yyyy %hh:%ii:%ss", Date()) 
We just went form daylight saving time
02/04/2023 23:56:20
03/04/2023 11:56:20