python 날짜 변환
-
[Python] datetime.strftime를 이용한 날짜와 시간 변환Python/Python Programming 2019. 4. 11. 13:31
from datetime import datetime timenow = datetime.now() # Current Time dt = timenow.strftime('%m-%d-%Y, %H:%M:%S') # datetime print(dt) 04-11-2019, 13:20:17 year1 = timenow.strftime('%Y') # Year with century as a decimal number print(year1) 2019 year2 = timenow.strftime('%y') # Year without century as a zero-padded decimal number print(year2) 19 month1 = timenow.strftime('%m') # Month as a zero-p..