std::time_get<CharT,InputIt>::date_order, std::time_get<CharT,InputIt>::do_date_order
来自cppreference.com
                    
                                        
                    
                    
                                                            
                    |   定义于头文件  <locale>
  | 
||
|   public: dateorder date_order() const;  | 
(1) | |
|   protected: virtual dateorder do_date_order() const;  | 
(2) | |
1) 公开成员函数,调用最终导出类的所保有虚成员函数 
do_date_order 。2) 返回 std::time_base::dateorder 类型值,它描述此 locale 所用的默认日期格式(为 get_date() 所期待并为 std::strftime() 用格式指定符 '%x' 所产生)。
合法值(继承自 std::time_base ):
  no_order
 | 
含有可变项目(星期之日、尤里乌斯日等),或未实现此函数 | 
  dmy
 | 
日、月、年(欧洲本地环境) | 
  mdy
 | 
月、日、年(美洲本地环境) | 
  ymd
 | 
年、月、日(亚洲本地环境) | 
  ydm
 | 
年、日、月(罕见) | 
参数
(无)
返回值
dateorder 类型值。
注意
此函数为可选,它可在每种情况下都返回 no_order 。
示例
运行此代码
#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) { case std::time_base::no_order: std::cout << "no_order\n"; break; case std::time_base::dmy: std::cout << "day, month, year\n"; break; case std::time_base::mdy: std::cout << "month, day, year\n"; break; case std::time_base::ymd: std::cout << "year, month, day\n"; break; case std::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(); }
输出:
In U.S. locale, the default date order is: month, day, year In Japanese locale, the default date order is: year, month, day In German locale, the default date order is: day, month, year
参阅
|    [虚]  | 
  从输入流输出月、日以及年  (虚受保护成员函数)  | 
|   定义日期格式常量  (类)  |