python date
-
[Python] Convert time string type to datetime date type. (날짜문자열을 타임 타입으로 변환)Python/Python Programming 2019. 10. 14. 00:26
datetime.date(year, month, day) * year, month, day는 숫자(interger) from datetime import date datefield = '2019-10-11' year, month, day = [int(x) for x in datefield.split('-') ] d = date(year, month, day) print(type(d)) print(d) ----------------------------------------------------------- 2019-10-11
-
[Python] Comparison of Datetime Type Using PythonPython/Python Programming 2018. 6. 15. 18:33
파이썬의 datetime 타입끼리 비교 연산이 가능하며, 결과는 True, False 로 리턴 from datetime import datetime from datetime import timedelta today = datetime.today() yesterday = today - timedelta(days=1) compare = today > yesterday print(compare) True