Skip to content

Instantly share code, notes, and snippets.

@CodyKochmann
Last active July 23, 2016 19:59
Show Gist options
  • Save CodyKochmann/e3c7be12569b35fcc5a2 to your computer and use it in GitHub Desktop.
Save CodyKochmann/e3c7be12569b35fcc5a2 to your computer and use it in GitHub Desktop.
timestamp.py
def timestamp(human_readable=False):
# Generates a unix timestamp and a human readable timestamp if passed True
# by: Cody Kochmann
from calendar import timegm
from datetime import datetime
if human_readable:
return(datetime.now())
else:
return(timegm(datetime.now().utctimetuple()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment