
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Python Pandas - Convert Timestamp to another time zone
Convert Timestamp to another time zone, use the timestamp.tz_convert(). Set the time zone as the parameter. At first, import the required libraries −
import pandas as pd
Create the timestamp object in Pandas. We have also set the timezone
timestamp = pd.Timestamp('2021-10-14T15:12:34.261811624', tz='US/Eastern')
Convert timezone of timestamp
timestamp.tz_convert('Australia/Brisbane'))
Example
Following is the code
import pandas as pd # set the timestamp object in Pandas # we have also set the timezone timestamp = pd.Timestamp('2021-10-14T15:12:34.261811624', tz='US/Eastern') # display the Timestamp print("Timestamp...\n", timestamp) # convert timezone print("\nConvert the Timestamp timezone...\n", timestamp.tz_convert('Australia/Brisbane'))
Output
This will produce the following code
Timestamp... 2021-10-14 15:12:34.261811624-04:00 Convert the Timestamp timezone... 2021-10-15 05:12:34.261811624+10:00
- Related Articles
- Python Pandas - Convert naive Timestamp to local time zone
- Python Pandas - Convert PeriodIndex object to Timestamp
- Python Pandas - Convert given Timestamp to Period
- Java Program to display Current Time in another Time Zone
- Python Pandas - Convert given Timestamp to Period with minutely frequency
- Python Pandas - Convert given Timestamp to Period with weekly frequency
- Python Pandas - Convert given Timestamp to Period with monthly frequency
- Python Pandas - Convert given Timestamp to Period with quarterly frequency
- Python Pandas - Convert given Timestamp to Period with hourly frequency
- Python Pandas - Convert PeriodIndex object to Timestamp and set the frequency
- Pandas - Convert a Timestamp object to a native Python datetime object
- Python Pandas - Get the current date and time from Timestamp object
- Python Pandas - Return a new Timestamp representing UTC day and time
- Python - Convert one datatype to another in a Pandas DataFrame
- Comparing Timestamp in Python – Pandas

Advertisements