std::time_get<CharT,InputIt>:: date_order, std::time_get<CharT,InputIt>:: do_date_order
From cppreference.net
C++
Text processing library
| 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 | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
Localization library
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::time_get
| Member functions | ||||
|
time_get::date_order
time_get::do_date_order
|
||||
|
定義先ヘッダ
<locale>
|
||
|
public
:
dateorder date_order ( ) const ; |
(1) | |
|
protected
:
virtual dateorder do_date_order ( ) const ; |
(2) | |
1)
パブリックメンバー関数。最も派生したクラスの保護された仮想メンバー関数
do_date_order
を呼び出す。
2)
型
std::time_base::dateorder
の値を返します。これは、このロケールで使用されるデフォルトの日付形式(
get_date()
で期待され、
std::strftime()
で書式指定子
'%x'
によって生成される)を記述します。
有効な値( std::time_base から継承)は以下の通り:
no_order
|
フォーマットに可変項目(曜日、ユリウス日など)が含まれる、またはこの機能が実装されていない |
dmy
|
日、月、年(ヨーロッパのロケール) |
mdy
|
月、日、年(アメリカのロケール) |
ymd
|
年、月、日(アジアのロケール) |
ydm
|
年、日、月(稀) |
目次 |
戻り値
dateorder
型の値。
注記
この関数はオプションであり、すべての場合において
no_order
を返す可能性があります。
例
以下の出力は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) { 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
関連項目
|
[virtual]
|
入力ストリームから月、日、年を抽出する
(仮想保護メンバ関数) |
|
日付フォーマット定数を定義する
(クラス) |