|
|
Joined: Dec 1999
Posts: 30,867
Master Elite Member
|
FUNCTION DirData_ToDateCreated (BYREF pDirData AS DIRDATA, OPTIONAL BYVAL Flags AS LONG) AS STRING
'Purpose
' Used to parse the DateCreated value from an existing DIRDATA structure.
'Parameters
' pDirData (DIRDATA) = The structure representing the file we're working with.
' Flags (Optional LONG) = A bit-field of behavior flags.
' Bit Fields:
' 0 If set, displays UTC time instead of local time.
' Example: DirData_ToDateCreated(pDD, 1) This will cause UTC time to be displayed.
' DirData_ToDateCreated(pDD, 0) This will cause local time to be displayed.
' ... All other bits are unused at this time.
'Return (STRING)
' Returns a string representing the date the file was created.
' The returned string is in this format: month/day/year hour:minute:second AM
' Example: "2/28/2010 4:28:03 PM"
'Dependencies
' The following files must be included: WIN32API.INC
' Must run on Win 2000 Pro or higher because both API calls require it.
'Version History
' 1.00 2010.03.02 Tested by Russ Tanner on PB/CC 5.03.
LOCAL fTime AS FILETIME
LOCAL sTime AS SYSTEMTIME
LOCAL szFormat AS ASCIIZ * 64, szTime AS ASCIIZ * 64, szDate AS ASCIIZ * 64
'Load the fTime structure.
fTime.dwLowDateTime = LO(DWORD, pDirData.CreationTime)
fTime.dwHighDateTime = HI(DWORD, pDirData.CreationTime)
'Convert the time using an API call.
FileTimeToSystemTime fTime, sTime
'Only display UTC if the corresponding flag is set.
IF (Flags AND 1) THEN
SystemTimeToTzSpecificLocalTime BYVAL %NULL, sTime, sTime ' Use this for UTC to Local time
END IF
'Format the time and date.
szFormat = "h':'mm':'ss tt"
GetTimeFormat %LOCALE_SYSTEM_DEFAULT, BYVAL %NULL, sTime, szFormat, szTime, SIZEOF (szTime)
szFormat = "M'/'d'/'yyyy"
GetDateFormat %LOCALE_SYSTEM_DEFAULT, BYVAL %NULL, sTime, szFormat, szDate, SIZEOF (szDate)
FUNCTION = szDate + " " + szTime
END FUNCTION
|
|
|
|
|