|
BOOL ParseDate( |
|
LPCTSTR lpszDate, |
|
|
LPLONG lpnSeconds, |
|
|
LPLONG lpnTimezone, |
|
|
BOOL bLocalize |
|
); |
The ParseDate method parses a date string, returning the
number of seconds since 1 January 1970 and the difference in seconds
between the specified timezone and coordinated universal time. If the
string does not specify a timezone, the local timezone is used.
Parameters
- lpszDate
- A pointer to a string which specifies the date
to be parsed. The date string must be in the standard format
defined by RFC 822.
- lpnSeconds
- A pointer to a long integer which is set to the number of
seconds since 1 January 1970 00:00:00 UTC. This date is commonly
called the epoch, and is the base date used by the standard C time
methods. This pointer may be NULL, in which case the parameter is
ignored.
- lpnTimezone
- A pointer to a long integer which is set to the difference in
seconds between the specified date's timezone and coordinated
universal time (also known as Greenwich Mean Time). This pointer
may be NULL, in which case the parameter is ignored.
- bLocalize
- A boolean flag which determines if the date should be localized
to the current timezone, regardless of the timezone specified in
the date string. A non-zero value specifies the timezone for the
local system will be used, adjusted for daylight savings time if
applicable.
Return Value
If the date could be successfully parsed, the return value is
non-zero. If the method fails, the return value is zero. To get
extended error information, call GetLastError.
Remarks
This method is not a general purpose date parsing function, and
may not be capable of parsing dates for a specific locale. The date
and time should be in a standard format as outlined in RFC 822,
which describes the basic structure of Internet email messages.
For a description of the date string format, refer to the
MimeFormatDate function.
If the date and time does not include any timezone information,
Coordinated Universal Time (UTC) will be used by default. This is an
important consideration if you use this function to parse input from a
user, because in most cases they will not provide a timezone and will
assume the date and time they enter is for their current timezone.
The value of the bLocalize parameter will only change the
number of seconds offset by the current timezone and does not affect
the value returned in the lpnSeconds parameter. If the date
is localized, the timezone offset will be adjusted for daylight
savings if it was in effect at the time.
Requirements
Minimum Desktop Platform: Windows 7 (Service Pack 1)
Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
Header File: cstools10.h
Import Library: csmsgv10.lib
Unicode: Implemented as Unicode and ANSI versions.
See Also
FormatDate,
GetDate, SetDate
|
|