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]
|
입력 스트림에서 월, 일, 연도를 추출합니다
(가상 protected 멤버 함수) |
|
날짜 형식 상수를 정의합니다
(클래스) |