2019년 9월 24일 화요일

unix timestamp를 datatime으로 바꾸는 방법


Python Exercise: Convert unix timestamp string to readable date


Python datetime: Exercise-6 with Solution

Write a Python program to convert unix timestamp string to readable date.
Sample Solution:
Python Code:
import datetime
print(
    datetime.datetime.fromtimestamp(
        int("1284105682")
    ).strftime('%Y-%m-%d %H:%M:%S')
)

Sample Output:
2010-09-10 13:31:22 


댓글 없음:

댓글 쓰기

람다 표현식 (Lambda expression)

람다 표현식(Lambda expression)  람다 표현식으로 함수를 정의하고, 이를 변수에 할당하여 변수를 함수처럼 사용한다. (1) 람다 표현식       lambda <매개변수> : 수식      ※ 람다식을 실행하...