Python

python 날짜

BIZLAB 2019. 10. 29. 16:45

from datetime import datetime

 

datetime.today()            # 현재 날짜 가져오기

datetime.today().year        # 현재 연도 가져오기

datetime.today().month      # 현재 월 가져오기

datetime.today().day        # 현재 일 가져오기

datetime.today().hour        # 현재 시간 가져오기



출처: https://yujuwon.tistory.com/entry/현재-날짜-가져오기 [Ju Factory]

 

 

 

해당월의 마지막 날짜

import calendar

 

calendar.monthrange(2019, 01)[1]