LocalFileTimeToFileTime Function

Declare Function LocalFileTimeToFileTime Lib "kernel32.dll" (lpLocalFileTime As FILETIME, lpFileTime As FILETIME) As Long

Platforms: Win 32s, Win 95/98, Win NT

LocalFileTimeToFileTime converts a time from local time (time according to the computer's current time zone) to UTC time (also known as Greenwich Mean Time). The source and target times are stored in FILETIME format. The function returns 1 if successful, or 0 if an error occured.

lpLocalFileTime
The time and date in local time to convert.
lpFileTime
Receives the time and date specified in lpLocalFileTime converted to UTC time.

Example:

' Convert the time and date May 1, 1999 6:10:00 PM local time
' to a FILETIME structure in UTC time.
Dim sourcetime As SYSTEMTIME  ' original time and date
Dim localtime As FILETIME  ' receives sourcetime's time
Dim utctime As FILETIME  ' receives the final result
Dim retval As Long  ' return value

' Set sourcetime to the desired date:
sourcetime.wMonth = 5: sourcetime.wDay = 1: sourcetime.wYear = 1999
sourcetime.wHour = 18: sourcetime.wMinute = 10: sourcetime.wSecond = 0

' Convert sourcetime into FILETIME format:
retval = SystemTimeToFileTime(sourcetime, localtime)
' Convert localtime into UTC time:
retval = LocalFileTimeToFileTime(localtime, utctime)
' utctime now has the converted time and date

See Also: FileTimeToLocalFileTime
Category: Time

Go back to the alphabetical Function listing.
Go back to the Reference section index.


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/l/localfiletimetofiletime.html