def formatTime(self, when):
"""
Return the given UTC value formatted as a human-readable string
representing that time in the local timezone.
@type when: C{int}
@param when: POSIX timestamp to convert to a human-readable string.
@rtype: C{str}
"""
if self.timeFormat is not None:
return time.strftime(self.timeFormat, time.localtime(when))
tzOffset = -self.getTimezoneOffset()
when = datetime.datetime.utcfromtimestamp(when + tzOffset)
tzHour = int(tzOffset / 60 / 60)
tzMin = int(tzOffset / 60 % 60)
return '%d/%02d/%02d %02d:%02d %+03d%02d' % (
when.year, when.month, when.day,
when.hour, when.minute,
tzHour, tzMin)
评论列表
文章目录