WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Time - Timer and Date Functions
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Time Stamp Changes with Daylight Savings

 Keywords: FileYMDHMS Time Stamp Change Different Daylight Savings

Question:

I am getting a different date time using the FileYMDHMS function and when viewing the file in Windows explorer since daylight savings started. (Off by 1 hour). Yet DOS shows me the same timestamp as FileYMDHMS:
 
Explorer     = 03/06/2013 4:22:00
FileYMDHMS   = 03/06/2013 5:22:00 (2013:03:06:17:22:00)
DOS          = 03/06/2013 5:22:00
Details:
WinBatch 2012B
Windows server 2008 R2
Local time setting: Eastern Daylight Savings Time
It would appear that both DOS and FileYMDHMS are converting the date using the systems local time settings, where as Explorer does not. I would like to update the documentation for FileYMDHMS to make note of this, but wanted to confirm with you first.

Answer:

Yes WIL functions convert a file time to local time using the users current settings for the time zone and daylight saving time. You must take care when using file times if the user has set the system to automatically adjust for daylight saving time.

Affected functions:

From Wikipedia (http://en.wikipedia.org/wiki/Daylight_saving_time)
The NTFS file system used by recent versions of Windows stores the file with a UTC time stamp, but displays it corrected to local—or seasonal—time. However, the FAT filesystem commonly used on removable devices stores only the local time. 
Consequently, when a file is copied from the hard disk onto separate media, its time will be set to the current local time. If the time adjustment is changed, perhaps automatically (daylight saving) or if the user selects a different time 
zone, then when the timestamps of the original file and the copy are compared there will be a difference. This may be verified (without having to wait for the next equinox) by copying a file, removing the media, adjusting the time zone 
options, reconnecting the media, and viewing the details of the file and its copy. The same effect can be observed when compressing and uncompressing files with some file archivers. It is the NTFS file that changes seen time. One can 
store a file listing and check it after the DST change. This effect should be kept in mind when trying to determine if a file is a duplicate of another although there are other methods of comparing files for equality like using checksum algorithms.
See FileCompare().

Article ID:   W18302
Filename:   Time Stamp Changes with Daylight Savings.txt
File Created: 2013:03:20:10:56:06
Last Updated: 2013:03:20:10:56:06