共用方式為


time_get::do_get_date

A protected virtual member function that is called to parse a string as the date produced by the x specifier for strftime.

virtual iter_type do_get_date(
   iter_type _First, 
   iter_type _Last,
   ios_base& _Iosbase, 
   ios_base::iostate& _State, 
   tm* _Pt
) const;

Parameters

  • _First
    Input iterator addressing the beginning of the sequence to be converted.

  • _Last
    Input iterator addressing the end of the sequence to be converted.

  • _Iosbase
    A format flag which when set indicates that the currency symbol is optional; otherwise, it is required.

  • _State
    Sets the appropriate bitmask elements for the stream state according to whether the operations succeeded.

  • _Pt
    A pointer to where the date information is to be stored.

Return Value

An input iterator addressing the first element beyond the input field.

Remarks

The virtual protected member function tries to match sequential elements beginning at first in the sequence [_First, _Last) until it has recognized a complete, nonempty date input field. If successful, it converts this field to its equivalent value as the components tm::tm_mon, tm::tm_day, and tm::tm_year, and stores the results in _Pt->tm_mon, _Pt->tm_day and _Pt->tm_year, respectively. It returns an iterator designating the first element beyond the date input field. Otherwise, the function sets _Iosbase**::failbit** in _State. It returns an iterator designating the first element beyond any prefix of a valid date input field. In either case, if the return value equals _Last, the function sets ios_base::eofbit in _State.

The format for the date input field is locale dependent. For the default locale, the date input field has the form MMM DD, YYYY, where:

  • MMM is matched by calling get_monthname, giving the month.

  • DD is a sequence of decimal digits whose corresponding numeric value must be in the range [1, 31], giving the day of the month.

  • YYYY is matched by calling get_year, giving the year.

The literal spaces and commas must match corresponding elements in the input sequence.

Example

See the example for get_date, which calls do_get_date.

Requirements

Header: <locale>

Namespace: std

See Also

Reference

time_get Class

Other Resources

time_get Members