JPB
12/10/2011 4:27:00 PM
System Time is in Coordinated Universal Time (UTC), you will need to
convert it to local time based on the system's time zone.
On Dec 9, 9:55 pm, BeeJ <nos...@spamnot.com> wrote:
> File time is way off.
> What am I missing?
>
> Windows Explorer Date Modified 12/9/2011 5:43 PM
> Size 4 KB
> And this agrees with the time I modified the file.
>
> But File Find WFD.ftLastWriteTime winds up with this time after
> calling the FileTimeSortable function.
> .wDay is wrong by one day, the next day.
> also the time .wHour is off.
> Yes, I know that one is 12 hr and the other is 24 hr format.
>
> year 2011
> month 12
> day 10
>
> hour 1
> minute 43
> second 50
>
> Size 3270
>
> Call my sub
> FileTimeSortable(WFD.ftLastWriteTime)
>
> Private Function FileTimeSortable(ByRef tFTime As FILETIME) As String
>
> Dim tSTime As SYSTEMTIME
> Const cs00 As String = "00"
> Const cs0000 As String = "0000"
> Dim dNow As Date
>
> If FileTimeToSystemTime(tFTime, tSTime) <> 0 Then
> With tSTime
> FileTimeSortable = Format$(.wYear, cs0000) & csSlh & _
> Format$(.wMonth, cs00) & csSlh & _
> Format$(.wDay, cs00) & csSp1 & _
> Format$(.wHour, cs00) & csCln & _
> Format$(.wMinute, cs00) & csCln & _
> Format$(.wSecond, cs00)
>
> <snip>
>
> Private Type FILETIME
> dwLowDateTime As Long
> dwHighDateTime As Long
> End Type
> '
> Private Type SYSTEMTIME
> wYear As Integer
> wMonth As Integer
> wDayOfWeek As Integer
> wDay As Integer
> wHour As Integer
> wMinute As Integer
> wSecond As Integer
> wMilliseconds As Integer
> End Type
> '
> MSDN notes
> ' Not all file systems can record creation and last access time
> ' and not all file systems record them in the same manner.
> ' For example, on NT FAT, create time has a resolution of 10
> milliseconds,
> ' write time has a resolution of 2 seconds,
> ' and access time has a resolution of 1 day (really, the access
> date).
> ' On NTFS, access time has a resolution of 1 hour.
>
> .