UTC दिन और समय का प्रतिनिधित्व करने वाला एक नया टाइमस्टैम्प वापस करने के लिए, timestamp.utcnow() का उपयोग करें तरीका। सबसे पहले, आवश्यक पुस्तकालयों को आयात करें -
import pandas as pd
टाइमस्टैम्प बनाना
timestamp = pd.Timestamp('2021-10-16T15:12:34.261811624', tz='UTC')
UTC दिन और समय के साथ नया टाइमस्टैम्प
timestamp.utcnow()
उदाहरण
निम्नलिखित कोड है
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()) आउटपुट
यह निम्नलिखित कोड उत्पन्न करेगा
Timestamp... 2021-10-16 15:12:34.261811624+00:00 UTC day and time... 2021-10-03 07:56:08.901294+00:00