티스토리 뷰

공부

[python] 기본 날짜와 시간 형식

승가비 2022. 8. 18. 00:45
728x90
%a 요일을 로케일의 축약된 이름으로.
Sun, Mon, …, Sat (en_US);
So, Mo, …, Sa (de_DE)
(1)
%A 요일을 로케일의 전체 이름으로.
Sunday, Monday, …, Saturday (en_US);
Sonntag, Montag, …, Samstag (de_DE)
(1)
%w 요일을 10진수로, 0은 일요일이고 6은 토요일입니다. 0, 1, …, 6  
%d 월중 일(day of the month)을 0으로 채워진 10진수로. 01, 02, …, 31 (9)
%b 월을 로케일의 축약된 이름으로.
Jan, Feb, …, Dec (en_US);
Jan, Feb, …, Dez (de_DE)
(1)
%B 월을 로케일의 전체 이름으로.
January, February, …, December (en_US);
Januar, Februar, …, Dezember (de_DE)
(1)
%m 월을 0으로 채워진 10진수로. 01, 02, …, 12 (9)
%y 세기가 없는 해(year)를 0으로 채워진 10진수로. 00, 01, …, 99 (9)
%Y 세기가 있는 해(year)를 10진수로. 0001, 0002, …, 2013, 2014, …, 9998, 9999 (2)
%H 시(24시간제)를 0으로 채워진 십진수로. 00, 01, …, 23 (9)
%I 시(12시간제)를 0으로 채워진 십진수로. 01, 02, …, 12 (9)
%p 로케일의 오전이나 오후에 해당하는 것.
AM, PM (en_US);
am, pm (de_DE)
(1), (3)
%M 분을 0으로 채워진 십진수로. 00, 01, …, 59 (9)
%S 초를 0으로 채워진 10진수로. 00, 01, …, 59 (4), (9)
%f Microsecond as a decimal number, zero-padded to 6 digits. 000000, 000001, …, 999999 (5)
%z ±HHMM[SS[.ffffff]] 형태의 UTC 오프셋 (객체가 나이브하면 빈 문자열). (비어 있음), +0000, -0400, +1030, +063415, -030712.345216 (6)
%Z 시간대 이름 (객체가 나이브하면 빈 문자열). (비어 있음), UTC, GMT (6)
%j 연중 일(day of the year)을 0으로 채워진 십진수로. 001, 002, …, 366 (9)
%U Week number of the year (Sunday as the first day of the week) as a zero-padded decimal number. All days in a new year preceding the first Sunday are considered to be in week 0. 00, 01, …, 53 (7), (9)
%W Week number of the year (Monday as the first day of the week) as a zero-padded decimal number. All days in a new year preceding the first Monday are considered to be in week 0. 00, 01, …, 53 (7), (9)
%c 로케일의 적절한 날짜와 시간 표현.
Tue Aug 16 21:30:00 1988 (en_US);
Di 16 Aug 21:30:00 1988 (de_DE)
(1)
%x 로케일의 적절한 날짜 표현.
08/16/88 (None);
08/16/1988 (en_US);
16.08.1988 (de_DE)
(1)
%X 로케일의 적절한 시간 표현.
21:30:00 (en_US);
21:30:00 (de_DE)
(1)
%% 리터럴 '%' 문자. %

https://docs.python.org/ko/3/library/datetime.html

 

datetime — 기본 날짜와 시간 형 — Python 3.10.6 문서

datetime — 기본 날짜와 시간 형 소스 코드: Lib/datetime.py datetime 모듈은 날짜와 시간을 조작하는 클래스를 제공합니다. 날짜와 시간 산술이 지원되지만, 구현의 초점은 출력 포매팅과 조작을 위한

docs.python.org

 

728x90
댓글