5

This answer explains how to convert any given epoch to a non-localized datetime.

This answer explains how to convert the epoch for right now to a human readable format for a pre-defined timezone.

This answer explains how to get the current system timezone, but not with pyzt, which is used in the human readable format answer.

How do I convert any given epoch to a human readable format for the system timezone?

Community
  • 1
  • 1
Chris Redford
  • 16,982
  • 21
  • 89
  • 109

1 Answers1

8

time.strftime combined with time.localtime should do the trick. The %Z option will output the system timezone. For example:

>>> print time.strftime("%Z - %Y/%m/%d, %H:%M:%S", time.localtime(time.time()))
CDT - 2014/07/15, 13:32:19

Here, you can replace time.time() with your chosen epoch.

TheSoundDefense
  • 6,753
  • 1
  • 30
  • 42