Within a VB.net program I used IO.File.GetCreationTime to read the file system's creation time of a file. I was irritated, because the returned value didn't match with the time displayed in the explorer. On another machine the time was displayed correctly.
timestamps displayed:
The good thing is, that the file I'm talking about is a PDF file. According to the PDF's meta information the file was created on 03. Jan. 2002 22:09
I want that the file system dates are the same on every machine. How would you solve this problem using VB.net?
I used a simple app to summarize the timestamp information:
GetLastWriteTime(file)
GetLastWriteTimeUtc(file)
GetLastWriteTime(file).ToLocalTime
GetLastWriteTimeUtc(file).ToLocalTime
GetLastWriteTime(file).ToFileTime
GetLastWriteTimeUtc(file).ToFileTime
Date.Now
Date.Now.UtcNow
The output was the same on both machines. For some reason I changed the time zone settings on both machines, switching DST on and off. The result is interesting ...
I guess it's the same effect vice versa. So my problem is just a disply issue. To solve this I will only use the UTC-Functions and care about DST within my app. So there still will be an offset, but it should be ok as long as it is just a display issue.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.