Skip to content

Instantly share code, notes, and snippets.

@VictorieeMan
Last active July 13, 2022 19:55
Show Gist options
  • Save VictorieeMan/7abc8559ed03bb274aaf6834501563a0 to your computer and use it in GitHub Desktop.
Save VictorieeMan/7abc8559ed03bb274aaf6834501563a0 to your computer and use it in GitHub Desktop.
Python funciton for getting a current timestamp
import datetime
def current_time(format = "%Y-%m-%d_%H-%M-%S"):
"""Calculates current time and returns a timestamp string."""
time = datetime.datetime.now()
timestamp = str(time.strftime(format))
return timestamp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment