Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Visual C++
Reference
Libraries Reference
ATL/MFC
COleDateTime Class
Member Functions
 COleDateTime::ParseDateTime
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
Shared Visual C++ Classes Reference 
COleDateTime::ParseDateTime 

Parses a string to read a date/time value.

bool ParseDateTime(
   LPCTSTR lpszDate,
   DWORD dwFlags = 0,
   LCID lcid = LANG_USER_DEFAULT 
) throw( );

Parameters

lpszDate

A pointer to the null-terminated string which is to be parsed. For details, see Remarks.

dwFlags

Indicates flags for locale settings and parsing. One or more of the following flags:

  • LOCALE_NOUSEROVERRIDE   Use the system default locale settings, rather than custom user settings.

  • VAR_TIMEVALUEONLY   Ignore the date portion during parsing.

  • VAR_DATEVALUEONLY   Ignore the time portion during parsing.

lcid

Indicates locale ID to use for the conversion.

Returns true if the string was successfully converted to a date/time value, otherwise false.

If the string was successfully converted to a date/time value, the value of this COleDateTime object is set to that value and its status to valid.

NoteNote

Year values must lie between 100 and 9999, inclusively.

The lpszDate parameter can take a variety of formats. For example, the following strings contain acceptable date/time formats:

"25 January 1996"
"8:30:00"
"20:30:00"
"January 25, 1996 8:30:00"
"8:30:00 Jan. 25, 1996"
"1/25/1996 8:30:00"  // always specify the full year,
                     // even in a 'short date' format

Note that the locale ID will also affect whether the string format is acceptable for conversion to a date/time value.

In the case of VAR_DATEVALUEONLY, the time value is set to time 0, or midnight. In the case of VAR_TIMEVALUEONLY, the date value is set to date 0, meaning 30 December 1899.

If the string could not be converted to a date/time value or if there was a numerical overflow, the status of this COleDateTime object is invalid.

For a listing of locale ID values, see the section Supporting Multiple National Languages in the Platform SDK.

For more information about the bounds and implementation for COleDateTime values, see the article Date and Time: Automation Support.

See the MantaWeb Sample.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker