|
LPTSTR FormatDate( |
|
LONG nSeconds, |
|
|
LONG nTimezone, |
|
|
LPTSTR lpszDate, |
|
|
INT cchMaxDate |
|
); |
LPTSTR FormatDate( |
|
LONG nSeconds, |
|
|
LPTSTR lpszDate, |
|
|
INT cchMaxDate |
|
); |
LPTSTR FormatDate( |
|
LONG nSeconds, |
|
|
LONG nTimezone, |
|
|
CString& strDate |
|
); |
LPTSTR FormatDate( |
|
LONG nSeconds, |
|
|
CString& strDate |
|
); |
The FormatDate converts the specified date, expressed as
the number of seconds since 1 January 1970, into a string compatible
with the RFC 822 standard format for email messages.
Parameters
- nSeconds
- A long integer which specifies 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. If the
value of this parameter is zero, the current date and time is
used.
- nTimezone
- A pointer to a long integer which is set to the difference in
seconds between the specified date's timezone and Coordinated
Universal Time. A value of zero
specifies Coordinated Universal Time, while a positive value
specifies a timezone west of UTC, and a negative value specifies a
timezone east of UTC. For example, the Eastern timezone would be
specified as the value 18000 and the Pacific timezone would be the
value 28800. If this argument is omitted from the method, then the
current timezone is used.
- lpszDate
- A buffer which will contain the formatted date as a
null-terminated string. This parameter cannot be a NULL
pointer.
- cchMaxDate
- The maximum number of characters, including the terminating
null character, which may be copied into the date string buffer.
Return Value
If the method succeeds, a pointer to the date string buffer is
returned. If the method fails, a NULL pointer is returned. To get
extended error information, call GetLastError.
Remarks
The date string is returned in a standard format as outlined in
RFC 822, the document which describes the basic structure of Internet
email messages. This format is as follows:
www, dd mmm yyyy hh:mm:ss [-]zzzz
Each part of the date string is defined as follows:
Format |
Description |
www |
Weekday |
dd |
Day |
mmm |
Month |
yyyy |
Year |
hh |
Hour (24-hour clock) |
mm |
Minutes |
ss |
Seconds |
zzzz |
Timezone |
The weekday and month are displayed using standard three-character
English abbreviations. The timezone is displayed as the difference
(in hours and minutes) between the specified timezone and Coordinated
Universal Time. For example, if the timezone is eight hours west of
Coordinated Universal Time, the nTimezone value would be
28800. This would be displayed as -0800 in the formatted date
string.
Note that the format of the date string is defined by the RFC 822
standard, and is not affected by localization settings on the host
system.
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
ParseDate,
GetDate, SetDate
|
|