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

Just starting out? Need help? Post your questions and find answers here.
jacky
User
User
Posts: 66
Joined: Mon Jan 21, 2019 1:41 pm

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

Post 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:
User avatar
mk-soft
Always Here
Always Here
Posts: 6255
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

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

Post by mk-soft »

UTC
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
highend
Enthusiast
Enthusiast
Posts: 169
Joined: Tue Jun 17, 2014 4:49 pm

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

Post by highend »

That code converts to UTC but the time is (still) wrong?

Code: Select all

LocalFileTimeToFileTime_(@LocalFileTime, @UTCFileTime)
User avatar
idle
Always Here
Always Here
Posts: 5923
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

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

Post 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
Post Reply