@@ -107,12 +107,14 @@ class Timestamp(_Timestamp):
107
107
try :
108
108
result += self .strftime(' %z ' )
109
109
if self .tzinfo:
110
- result += self .strftime(' %% Z, tz=%s ' % self .tzinfo.zone)
110
+ zone = _get_zone(self .tzinfo)
111
+ result += self .strftime(' %% Z, tz=%s ' % zone)
111
112
except ValueError :
112
113
year2000 = self .replace(year = 2000 )
113
114
result += year2000.strftime(' %z ' )
114
115
if self .tzinfo:
115
- result += year2000.strftime(' %% Z, tz=%s ' % self .tzinfo.zone)
116
+ zone = _get_zone(self .tzinfo)
117
+ result += year2000.strftime(' %% Z, tz=%s ' % zone)
116
118
117
119
return ' <Timestamp: %s >' % result
118
120
@@ -615,6 +617,9 @@ cpdef convert_to_tsobject(object ts, object tz=None):
615
617
616
618
return obj
617
619
620
+ def get_timezone (tz ):
621
+ return _get_zone(tz)
622
+
618
623
cdef inline bint _is_utc(object tz):
619
624
return tz is UTC or isinstance (tz, _du_utc)
620
625
@@ -911,7 +916,7 @@ def tz_convert(ndarray[int64_t] vals, object tz1, object tz2):
911
916
912
917
# Convert to UTC
913
918
914
- if tz1.zone != ' UTC' :
919
+ if _get_zone( tz1) != ' UTC' :
915
920
utc_dates = np.empty(n, dtype = np.int64)
916
921
deltas = _get_deltas(tz1)
917
922
trans = _get_transitions(tz1)
@@ -929,7 +934,7 @@ def tz_convert(ndarray[int64_t] vals, object tz1, object tz2):
929
934
else :
930
935
utc_dates = vals
931
936
932
- if tz2.zone == ' UTC' :
937
+ if _get_zone( tz2) == ' UTC' :
933
938
return utc_dates
934
939
935
940
# Convert UTC to other timezone
@@ -968,7 +973,7 @@ def tz_convert_single(int64_t val, object tz1, object tz2):
968
973
969
974
# Convert to UTC
970
975
971
- if tz1.zone != ' UTC' :
976
+ if _get_zone( tz1) != ' UTC' :
972
977
deltas = _get_deltas(tz1)
973
978
trans = _get_transitions(tz1)
974
979
pos = trans.searchsorted(val) - 1
@@ -979,7 +984,7 @@ def tz_convert_single(int64_t val, object tz1, object tz2):
979
984
else :
980
985
utc_date = val
981
986
982
- if tz2.zone == ' UTC' :
987
+ if _get_zone( tz2) == ' UTC' :
983
988
return utc_date
984
989
985
990
# Convert UTC to other timezone
0 commit comments