[Python Exam] 파이썬 현재 시간 및 날짜 구하기

2019.08.16 19:37Python/ㄴ Exam Code

from datetime import datetime

now = datetime.now()

print("now date and time : " + str(now))
print("now year : " + str(now.year))
print("now month : " + str(now.month))
print("now day : " + str(now.day))
print("now hour : " + str(now.hour))
print("now min : " + str(now.minute))
print("now second : " + str(now.second))
print("now date : {}-{}-{}".format(now.year, now.month, now.day))

datetime 모듈 사용했습니다.

1 2 3 4 5 6 7 8 9 ··· 51