[Python] 날짜&시간 모듈 사용 [datetime module]
2021. 6. 28. 08:30ㆍPython
반응형
[우선 따라해보는 Python]
import datetime
now = datetime.datetime.now()
print(now) #현재 전체시간
print(now.year) #현재 년도
print(now.month) #현재 달
print(now.day) #현재 일
print(now.hour) #현재 시
print(now.minute) #현재 분
print(now.second) #현재 초
<출력>
2019-08-26 15:01:11.063327
2019
8
26
15
1
11
반응형
'Python' 카테고리의 다른 글
[Python] Pyinstaller를 이용하여 py 파일 exe 실행 파일로 변환 (.py to .exe) (5) | 2021.06.28 |
---|---|
[Python] 쓰레드 Thread 사용하는 방법 (1) | 2021.06.28 |
[Python] keyboard control, 키보드 제어하는 방법 [pynput-keyboard] (0) | 2021.06.28 |
[Python] mouse control, 마우스 제어 하는 방법 [pynput-mouse] (0) | 2021.06.28 |
[Python] 날씨 정보 api, Darksky forecastio api 사용하는방법 [forecastio] (2) | 2021.06.28 |