Skip to content

Instantly share code, notes, and snippets.

@kurozumi

kurozumi/get_weekday.py

Last active Jun 1, 2016
Embed
What would you like to do?
【Python】日付から曜日を取得する方法
# coding: utf-8
def get_weekday(date):
import datetime
weekday = ["月","火","水","木","金","土","日"]
d = datetime.datetime.strptime(date, "%Y/%m/%d")
return weekday[d.weekday()]
if __name__ == "__main__":
print get_weekday("2016/05/31")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.