Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- Numpy
- paramiko
- LIST
- C++
- OpenCV
- error
- 채보
- windows forms
- Visual Studio
- 핑거스타일
- pip
- pytorch
- VS Code
- C
- 오류
- mysql
- SSH
- JSON
- pandas
- ubuntu
- Linux
- C#
- 기타 연주
- YOLO
- Selenium
- label
- Docker
- 프로그래머스
- 컨테이너
- Python
Archives
- Today
- Total
기계는 거짓말하지 않는다
Python 날짜 문자열 변환 본문
import datetime
import time
now = datetime.datetime.now()
print(now) # 2022-08-25 09:11:41.090583
# yyyy-mm-dd 형식
formatted_date = now.strftime("%Y-%m-%d")
print(formatted_date) # 2022-08-25
print(type(formatted_date)) # <class 'str'>
print(type(now)) # <class 'datetime.datetime'>
strftime() 반환 결과는 string이다. strftime() 포맷 코드는 다음 문서를 참조
'Python' 카테고리의 다른 글
Python 경로 확장자, 파일 이름 분리 (0) | 2022.09.17 |
---|---|
Python 특정 코드 실행 시간 시간:분:초 출력 (0) | 2022.09.11 |
Python RLock 자원 동시 접근 관리 (0) | 2022.07.22 |
Python Error argument after * must be an iterable, not Queue (0) | 2022.06.10 |
Python configparser key 대소문자 구분 (0) | 2022.05.21 |
Comments