Skip to content

Instantly share code, notes, and snippets.

@mezhgano
Created April 3, 2023 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mezhgano/10081e52e56915b2783eb91361271a79 to your computer and use it in GitHub Desktop.
Save mezhgano/10081e52e56915b2783eb91361271a79 to your computer and use it in GitHub Desktop.
Convert epoch to datetime
from datetime import datetime
def _epoch_to_datetime(self, epoch:int, strf='%Y-%m-%d_%H-%M-%S') -> str:
'Return human readable datetime string from given epoch int.'
return datetime.fromtimestamp(epoch).strftime(strf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment