[module] datetime

2020. 2. 1. 17:58개발자료/Python


반응형

# import

import datetime

# 연월일시분초.마이크로초

print(datetime.datetime.now())

2020-02-01 17:45:24.474160

# 시분초.마이크로초

print(datetime.datetime.now().time())

17:45:25.474160

# datetime 사용간소화

from datetime import datetime

이후에는 datetime.now() 형태로 사용하면 된다.

참고사이트

https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior

 

8.1. datetime — Basic date and time types — Python 2.7.17 documentation

8.1. datetime — Basic date and time types The datetime module supplies classes for manipulating dates and times in both simple and complex ways. While date and time arithmetic is supported, the focus of the implementation is on efficient attribute extracti

docs.python.org

 

반응형

'개발자료 > Python' 카테고리의 다른 글

Dictionary - 딕셔너리  (0) 2020.04.02
PIP - 모듈 설치 명령어  (0) 2020.03.16
배열, Array, 리스트, List  (0) 2020.01.29
URL 파싱  (0) 2020.01.24
BeautifulSoup 사용법  (0) 2019.01.10