UTC 오프셋 시간을 얻으려면 timestamp.utcoffset()을 사용하세요. . 먼저 필요한 라이브러리를 가져옵니다 -
import pandas as pd
타임스탬프 생성
timestamp = pd.Timestamp('2021-10-16T15:12:34.261811624', tz='UTC')
UTC 날짜 및 시간이 포함된 새 타임스탬프
timestamp.utcnow()
UTC 오프셋 시간 가져오기
timestamp.utcoffset()
예시
다음은 코드입니다.
import pandas as pd
# creating a timestamp
timestamp = pd.Timestamp('2021-10-16T15:12:34.261811624', tz='UTC')
# display the Timestamp
print("Timestamp...\n", timestamp)
# new timestamp with UTC day and time
print("\nUTC day and time...\n", timestamp.utcnow())
# Get the UTC offset time
print("\nUTC offset time...\n", timestamp.utcoffset()) 출력
그러면 다음 코드가 생성됩니다.
Timestamp... 2021-10-16 15:12:34.261811624+00:00 UTC day and time... 2021-10-03 07:56:44.685816+00:00 UTC offset time... 0:00:00