티스토리 뷰

공부

[Python] String to Date; Date to String

seunggabi 승가비 2021. 1. 19. 19:35
import datetime


def string_to_date(dt, format='%Y%m%d'):
    return datetime.datetime.strptime(dt, format)

def date_to_string(date, format='%Y%m%d'):
    return datetime.datetime.strftime(date, format)

 

'공부' 카테고리의 다른 글

[Sh] exit()  (0) 2021.01.21
[Python] weekday(); week of day (feat. date_to_string & string_to_date)  (0) 2021.01.21
[Python] String to Date; Date to String  (0) 2021.01.19
[Slack] slacker.Error: missing_scope  (0) 2021.01.14
[Chart.js] make chart image  (0) 2021.01.14
[Slack] send image  (0) 2021.01.14
댓글
댓글쓰기 폼