
- Python 3 Basic Tutorial
- Python 3 - Home
- What is New in Python 3
- Python 3 - Overview
- Python 3 - Environment Setup
- Python 3 - Basic Syntax
- Python 3 - Variable Types
- Python 3 - Basic Operators
- Python 3 - Decision Making
- Python 3 - Loops
- Python 3 - Numbers
- Python 3 - Strings
- Python 3 - Lists
- Python 3 - Tuples
- Python 3 - Dictionary
- Python 3 - Date & Time
- Python 3 - Functions
- Python 3 - Modules
- Python 3 - Files I/O
- Python 3 - Exceptions
Python Pandas - Get the UTC Offset Time
To get the UTC Offset Time, use the timestamp.utcoffset(). At first, import the required libraries −
import pandas as pd
Creating a timestamp
timestamp = pd.Timestamp('2021-10-16T15:12:34.261811624', tz='UTC')
New timestamp with UTC day and time
timestamp.utcnow()
Get the UTC offset time
timestamp.utcoffset()
Example
Following is the code
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())
Output
This will produce the following code
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
- Related Articles
- How to get computer's UTC offset in Python?
- Python Pandas - Return a new Timestamp representing UTC day and time
- Python Pandas - Get the weekmask applied on the CustomBusinessDay offset
- Python Pandas - Get the weekmask applied on the CustomBusinessHour offset
- Python Pandas - Create a BusinessDay offset
- Python Pandas - Create a BusinessHour offset
- Python Pandas - Select final periods of time series data based on a date offset
- Python Pandas - Select first periods of time series data based on a date offset
- Python Pandas - Create a CustomBusinessDay Offset object
- Python Pandas - Create a CustomBusinessHour Offset object
- Python Pandas - Construct a naive UTC datetime from a POSIX timestamp
- Python Pandas - Get the current date and time from Timestamp object
- Get the IDs according to the given time zone offset in Java
- Python Pandas - Display the start time of the custom business hour in 24h format from the BusinessHour offset object
- Python Pandas - Display the end time of the custom business hour in 24h format from the BusinessHour offset object

Advertisements