Return a datetime object with new tzinfo attribute tz, adjusting the date and time data so the result is the same UTC time as self, but in tz’s local time.
datetime.astimezone(tz=None)
def astimezone(self, tz):
if self.tzinfo is tz:
return self
Convert self to UTC, and attach the new time zone object.
utc = (self - self.utcoffset()).replace(tzinfo=tz)
Convert from UTC to tz's local time.
return tz.fromutc(utc)