Skip to content

Commit c224bf0

Browse files
committed
added example for timezone string for Timestamp.now
1 parent 415830f commit c224bf0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pandas/_libs/tslibs/timestamps.pyx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1917,7 +1917,9 @@ class Timestamp(_Timestamp):
19171917
Return new Timestamp object representing current time local to tz.
19181918

19191919
This method returns a new `Timestamp` object that represents the current time.
1920-
If a timezone is provided, the current time will be localized to that timezone.
1920+
If a timezone is provided, either through a timezone object or an IANA
1921+
standard timezone identifier, the current time will be localized to that
1922+
timezone.
19211923
Otherwise, it returns the current local time.
19221924

19231925
Parameters
@@ -1936,6 +1938,12 @@ class Timestamp(_Timestamp):
19361938
>>> pd.Timestamp.now() # doctest: +SKIP
19371939
Timestamp('2020-11-16 22:06:16.378782')
19381940

1941+
If you want a specific timezone, in this case 'Brazil/East':
1942+
1943+
>>> pd.Timestamp.now('Brazil/East')
1944+
Timestamp('2025-11-11 22:17:59.609943-03:00)
1945+
1946+
19391947
Analogous for ``pd.NaT``:
19401948

19411949
>>> pd.NaT.now()

0 commit comments

Comments
 (0)