Created
April 18, 2019 03:57
-
-
Save fereria/2c22cba87a188f4621e15848a6a12618 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
datetimeの使い方 | |
""" | |
from datetime import datetime | |
now = datetime.now() | |
# str->datetime | |
string_date = '2017/07/01 12:06:19' | |
datetime.strptime(string_date, '%Y/%m/%d %H:%M:%S') | |
# datetime->str | |
str_time = now.strftime('%Y/%m/%d %H:%M:%S') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment