| |
| INT GetDate( |
| |
LPTSTR lpszDate, |
|
| |
INT nMaxLength, |
|
| |
BOOL bLocalize |
|
| ); |
| INT GetDate( |
| |
CString &strDate, |
|
| |
BOOL bLocalize |
|
| ); |
The GetDate method returns the current message date and time.
Parameters
- lpszDate
- A null-terminated string buffer which will contain the message
date. This parameter cannot be NULL. An alternate version of this
method accepts a reference to a CString object which will
contain the date and time when the method returns.
- nMaxLength
- The maximum number of characters which can be copied into the
string buffer, including the terminating null character. This
parameter cannot be zero.
- bLocalize
- An optional boolean flag which specifies if the date and time should be
localized for the current timezone. If this parameter is omitted,
the date and time will not be localized.
Return Value
If the method succeeds, the return value the length of the date and
time string, not including the terminating null character. If the method fails, it will return
zero.
To get extended error information, call GetLastError.
Remarks
The GetDate method copies the formatted date string into the
buffer provided by the caller. If the message contains a valid
Date or Sent header, the function retrieves
and, if requested, localizes the date and time string before copying
it to the specified buffer. The returned string always conforms to the
standard format described in RFC 822. To convert this date string
into a numeric value suitable for time calculations, use the
ParseDate method.
Previous versions of this method returned a pointer to a string
managed by the internal message context which could be invalidated or
overwritten by subsequent operations. This version ensures the date
string remains valid for the lifetime of the caller's buffer, avoiding
issues with internal pointer reuse or invalidation that could occur in
multithreaded or reentrant scenarios.
Requirements
Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: csmsgv12.lib
Unicode: Implemented as Unicode and ANSI versions
See Also
|
|