Open In App

Python | Pandas Timestamp.now

Last Updated : 11 Jul, 2025
Comments
Improve
Suggest changes
7 Likes
Like
Report

Python is a great language for data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages that makes importing and analyzing data much easier.

Pandas Timestamp.now() function returns the current time in the local timezone. It is Equivalent to datetime. now([tz]).

Pandas Timestamp.now Syntax

Syntax :Timestamp.now()

Parameters : None

Return : A Timestamp object representing the current time in the specified timezone.

Timestamp.now in Pandas Examples

The Timestamp.now() method in Pandas is used to create a Timestamp object representing the current time. A Timestamp object is a data type in Pandas that represents a specific point in time. It includes the date, time, and timezone information. Here we will see different examples on how to use this method:

Get Current Timestamp with Pandas

The code shows how to use Pandas Timestamp.now() to get the current date and time.

Output:

Current Timestamp: 2023-10-12 07:24:35.042577

Get Current Time with Timestamp Objects in Pandas

Use Timestamp.now() the function to return the current time in the local timezone.

Output :

2011-11-21 10:00:49-06:00
Timestamp('2023-10-12 07:25:32.822525')

As we can see in the output, the Timestamp.now() function has returned the current time in the local timezone. It auto-detects the local timezone.  

Generating Timestamps and Creating Time-Series Data using Pandas

Timestamped data associates each record with a specific timestamp. This is common when recording temperature, stock prices, or any other measurement over time. The pd.Timestamp.now() function creates timestamped data.

Output:

                                            timestamp  temperature 
0          2023-08-20 04:40:14.707909         21.2 
1            2023-08-21 04:40:14.707909         23.2 
2           2023-08-22 04:40:14.707909         27.2 
3           2023-08-23 04:40:14.707909         29.2 
4           2023-08-24 04:40:14.707909         31.2

Creating a Time-Series DataFrame with Timestamped Indices using Pandas

When working with time-series data, it's crucial to use timestamped indices for easy time-based operations and calculations.

Output:

                                                     temperature  humidity
2023-08-18 04:44:10.054030              23.3        43 
2023-08-19 04:44:10.054030              34.5        58 
2023-08-20 04:44:10.054030              22.1        54 
2023-08-21 04:44:10.054030              22.0        34 
2023-08-22 04:44:10.054030             31.3        47 
2023-08-23 04:44:10.054030            33.4        56 
2023-08-24 04:44:10.054030            43.2        40

Explore