POSIX 타임스탬프에서 순진한 UTC 날짜/시간을 구성하려면 timestamp.utcfromtimestamp()를 사용하세요. 방법. POSIX를 인수로 전달합니다.
먼저 필요한 라이브러리를 가져옵니다 -
import pandas as pd
타임스탬프 생성
timestamp = pd.Timestamp('2021-09-14T15:12:34.261811624')
POSIX 타임스탬프에서 순진한 UTC 날짜/시간을 구성합니다. POSIX는 인수로 전달됩니다.
timestamp.utcfromtimestamp(1631717502)
예
다음은 코드입니다.
import pandas as pd
# creating a timestamp
timestamp = pd.Timestamp('2021-09-14T15:12:34.261811624')
# display the Timestamp
print("Timestamp...\n", timestamp)
# constructing a naive UTC datetime from a POSIX timestamp
# POSIX is passed as an argument
print("\nConstruct UTC Datetime...\n", timestamp.utcfromtimestamp(1631717502)) 출력
그러면 다음 코드가 생성됩니다.
Timestamp... 2021-09-14 15:12:34.261811624 Construct UTC Datetime... 2021-09-15 14:51:42