pandas.Timestamp.toordinal#

Timestamp.toordinal()#

Return proleptic Gregorian ordinal. January 1 of year 1 is day 1.

The proleptic Gregorian ordinal is a continuous count of days since January 1 of year 1, which is considered day 1. This method converts the Timestamp to its equivalent ordinal number, useful for date arithmetic and comparison operations.

See also

datetime.datetime.toordinal

Equivalent method in the datetime module.

Timestamp

The Timestamp that represents a specific point in time.

Timestamp.fromordinal

Create a Timestamp from an ordinal.

Examples

>>> ts = pd.Timestamp('2023-01-01 10:00:50')
>>> ts
Timestamp('2023-01-01 10:00:50')
>>> ts.toordinal()
738521