일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- Database
- evaluation
- Paper
- pytorch
- LLM
- docker
- TORCH
- judge
- DB
- Mac
- Flask
- GitLab
- pandas
- PostgreSQL
- Windows
- numpy
- KAKAO
- Linux
- Container
- Converting
- Laravel
- format
- list
- enV
- AI
- Package
- file
- Python
- CUDA
- git
Archives
- Today
- Total
Daily Develope
[Python] 시간 변환 (datetime) 본문
생성
- 현재시간 생성
from datetime import date
today:datetime = date.today()
변환
X to Datetime
- timestamp to datetime
from datetime import datetime
...
datetime.fromtimestamp(timestamp_value).strftime("%Y/%m/%d %H:%M:%S")
# output : 2000/01/01 12:34:56
- string to datetime
from datetime import datetime
from datetime import date
today_str = "2000 01 01"
today = datetime.strptime(today_str, "%Y %m %d")
# print(today) : 2000 01 01
- datetime to datetime (포맷 변환)
Datetime to String
from datetime import datetime
from datetime import date
today:datetime = date.today()
today_str = today.strftime("%Y %m %d")
# print(today_str) : 2000 01 01
시간 기술 포맷
'Develope > Python' 카테고리의 다른 글
[Python] 문법 (grammer) 예제로 간단 정리 (0) | 2023.04.10 |
---|---|
[Python] Multi processing 멀티 프로세싱 (0) | 2023.02.15 |
[Python] Json 읽기 / 쓰기 (0) | 2022.11.15 |
[Python] 단위테스트 (Unit test) (0) | 2022.10.25 |
[Python] 엑셀(Excel) 파일 데이터 읽기/쓰기 (0) | 2022.09.22 |
Comments