| Localization library | |||||||||||||||||||||||||
| Regular expressions library(C++11) | |||||||||||||||||||||||||
| Formatting library(C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||
time_get::date_ordertime_get::do_date_order | ||||
Defined in header <locale> | ||
public: dateorder date_order()const; | (1) | |
protected: virtual dateorder do_date_order()const; | (2) | |
do_date_order of the most derived class.The valid values (inherited fromstd::time_base) are:
no_order | the format contains variable items (week day, Julian day, etc), or this function is not implemented |
dmy | day, month, year (European locales) |
mdy | month, day, year (American locales) |
ymd | year, month, day (Asian locales) |
ydm | year, day, month (rare) |
Contents |
A value of typedateorder.
This function is optional, it may returnno_order in every case.
The output below was obtained using clang (libc++).
#include <iostream>#include <locale> void show_date_order(){std::time_base::dateorder d=std::use_facet<std::time_get<char>>(std::locale()).date_order();switch(d){casestd::time_base::no_order:std::cout<<"no_order\n";break;casestd::time_base::dmy:std::cout<<"day, month, year\n";break;casestd::time_base::mdy:std::cout<<"month, day, year\n";break;casestd::time_base::ymd:std::cout<<"year, month, day\n";break;casestd::time_base::ydm:std::cout<<"year, day, month\n";break;}} int main(){std::locale::global(std::locale("en_US.utf8"));std::cout<<"In U.S. locale, the default date order is: "; show_date_order(); std::locale::global(std::locale("ja_JP.utf8"));std::cout<<"In Japanese locale, the default date order is: "; show_date_order(); std::locale::global(std::locale("de_DE.utf8"));std::cout<<"In German locale, the default date order is: "; show_date_order();}
Possible output:
In U.S. locale, the default date order is: month, day, yearIn Japanese locale, the default date order is: year, month, dayIn German locale, the default date order is: day, month, year
[virtual] | extracts month, day, and year from input stream (virtual protected member function)[edit] |
| defines date format constants (class)[edit] |