datetime

2019. 11. 21. 17:09카테고리 없음

(1) datetime 모듈 사용하기 ( 공식문서는 여기 를 참조하세요 )

   만약, import datetime as dt 

(2) 나누고 재구성하기 

  datetime.strptime() 

       일 두자리 / 월 두자리 / 연도 네자리

  datetime.strptime() 와 datetime.strftime() 비교 

  아래는 예제 

   예제) The format of the app_start_date column is {month}/{day}/{two digit year} {hour 24hr time}:{minute}

          위 형태로 format 만들어서 모두 바꿔주기 

 

    

(3) object로 저장하기 

  • datetime.day: The day of the month.
  • datetime.month: The month of the year.
  • datetime.year: The year.
  • datetime.hour: The hour of the day.
  • datetime.minute: The minute of the hour.

 

 

(4) timedelta 구하기