반응형
1. 현재 날짜와 시간을 구하고 strftime을 이용해 특정 format으로 변환 후 출력
Code
1
2
3
4
5
6
7
8
9
10
|
import time
now_YYYYmmdd = time.strftime('%Y%m%d')
print(f"now_YYYYmmdd: {now_YYYYmmdd}")
now_yymmdd = time.strftime('%y%m%d')
print(f"now_yymmdd: {now_yymmdd}")
now_HHMMSS = time.strftime('%H%M%S')
print(f"now_HHMMSS: {now_HHMMSS}")
|
cs |
Result
now_YYYYmmdd: 20221229 now_yymmdd: 221229 now_HHMMSS: 110224 |