GetFileAttributesEx returns the date that the filesystem returns, unmodified. NTFS stores dates in UTC, and FAT stores them in the local time zone. Without knowing the time zone, a date is pretty worthless.
What is the best way to reliably get the last modified date of a file in UTC? Is the best way really to just check for NTFS vs. FAT? What if you are using a different filesystem? Is there a different API I can use? Is there some elegant code someone can post here?
Use the Win32 API GetFileTime, it returns all its times in UTC. Yes, FAT file system does store these values in local time, but the Win32 API is doing the UTC conversion for you.
Quote from the ‘FileTimes‘ MSDN documentation: