File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -238,6 +238,8 @@ class Timestamp(_Timestamp):
238
238
# Same UTC timestamp, different time zone
239
239
return Timestamp(self .value, tz = tz)
240
240
241
+ astimezone = tz_convert
242
+
241
243
def replace (self , **kwds ):
242
244
return Timestamp(datetime.replace(self , ** kwds),
243
245
offset = self .offset)
Original file line number Diff line number Diff line change @@ -137,6 +137,13 @@ def test_tz_localize_dti(self):
137
137
freq = 'L' )
138
138
self .assertRaises (pytz .NonExistentTimeError , dti .tz_localize , 'US/Eastern' )
139
139
140
+ def test_astimezone (self ):
141
+ utc = Timestamp ('3/11/2012 22:00' , tz = 'UTC' )
142
+ expected = utc .tz_convert ('US/Eastern' )
143
+ result = utc .astimezone ('US/Eastern' )
144
+ self .assertEquals (expected , result )
145
+ self .assert_ (isinstance (result , Timestamp ))
146
+
140
147
def test_create_with_tz (self ):
141
148
stamp = Timestamp ('3/11/2012 05:00' , tz = 'US/Eastern' )
142
149
self .assertEquals (stamp .hour , 5 )
You can’t perform that action at this time.
0 commit comments