|
1 members (Russ),
10,950
guests, and
1,516
robots. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
S |
M |
T |
W |
T |
F |
S |
|
|
|
1
|
2
|
3
|
4
|
5
|
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
|
13
|
14
|
15
|
16
|
17
|
18
|
19
|
|
20
|
21
|
22
|
23
|
24
|
25
|
26
|
|
27
|
28
|
29
|
30
|
31
|
|
|
|
|
This is another custom island. This one could be used for ads. This spot is one of the best places for ads on your site to be placed. This can be enabled/disabled on a per forum basis.
|
|
|
|
Joined: Dec 1999
Posts: 30,868
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
|
|
|
|
|
Joined: Dec 1999
Posts: 30,868
Master Elite Member
|
FUNCTION DirData_ToDateCreated (BYREF pDirData AS DIRDATA, OPTIONAL BYVAL DateTemplate AS STRING, OPTIONAL BYVAL TimeTemplate AS STRING, 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.
' DateTemplate (Optional STRING) = A template used to determine the structure of the returned date.
' This template follows the same rules as the Windows GetDateFormat()#lpFormat parameter.
' Character enclosed in single quotes are literals that are retained in the output string.
' Valid values:
' d Day of month as digits with no leading zero for single-digit days.
' dd Day of month as digits with leading zero for single-digit days.
' ddd Day of week as a three-letter abbreviation.
' The function uses the LOCALE_SABBREVDAYNAME value associated with the specified locale.
' ddd Day of week as its full name. The function uses the LOCALE_SDAYNAME value associated with the specified locale.
' M Month as digits with no leading zero for single-digit months.
' MM Month as digits with leading zero for single-digit months.
' MMM Month as a three-letter abbreviation.
' The function uses the LOCALE_SABBREVMONTHNAME value associated with the specified locale.
' MMMM Month as its full name. The function uses the LOCALE_SMONTHNAME value associated with the specified locale.
' y Year as last two digits, with a leading zero for years less than 10. The same format as "yy."
' yy Year as last two digits, with a leading zero for years less than 10.
' yyyy Year represented by full four digits.
' gg Period/era string. The function uses the CAL_SERASTRING value associated with the specified locale.
' This element is ignored if the date to be formatted does not have an associated era or period string.
' Examples: "ddd',' MMM dd yy" returns "Wed, Aug 31 94"
' "yyyy" returns 1994
' To return no date value (zero-length string), use this string: "''"
' Default if omitted or zero-length: "M'/'d'/'yyyy"
' TimeTemplate (Optional STRING) = A template used to determine the structure of the returned time.
' This template follows the same rules as the Windows GetDateFormat()#lpFormat parameter.
' Character enclosed in single quotes are literals that are retained in the output string.
' Valid values:
' h Hours with no leading zero for single-digit hours; 12-hour clock
' hh Hours with leading zero for single-digit hours; 12-hour clock
' H Hours with no leading zero for single-digit hours; 24-hour clock
' HH Hours with leading zero for single-digit hours; 24-hour clock
' m Minutes with no leading zero for single-digit minutes
' mm Minutes with leading zero for single-digit minutes
' s Seconds with no leading zero for single-digit seconds
' ss Seconds with leading zero for single-digit seconds
' t One character time marker string, such as A or P
' tt Multicharacter time marker string, such as AM or PM
' Examples: "hh':'mm':'ss tt" returns "11:29:40 PM"
' "h" returns "11"
' To return no time value (zero-length string), use this string: "''"
' Default if omitted or zero-length: "h':'mm':'ss tt"
' 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.
' Default: 0 (zero)
'Return (STRING)
' Returns a string representing the date the file was created.
'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 ISFALSE (Flags AND 1) THEN
SystemTimeToTzSpecificLocalTime BYVAL %NULL, sTime, sTime 'Convert to local time
END IF
'Format the time and date.
szFormat = IIF$(LEN(TimeTemplate) > 0, TimeTemplate, "h':'mm':'ss tt")
GetTimeFormat %LOCALE_SYSTEM_DEFAULT, BYVAL %NULL, sTime, szFormat, szTime, SIZEOF (szTime)
szFormat = IIF$(LEN(DateTemplate) > 0, DateTemplate, "M'/'d'/'yyyy")
GetDateFormat %LOCALE_SYSTEM_DEFAULT, BYVAL %NULL, sTime, szFormat, szDate, SIZEOF (szDate)
FUNCTION = szDate + " " + szTime
END FUNCTION
|
|
|
|
|