Last active
July 13, 2022 19:55
-
-
Save VictorieeMan/7abc8559ed03bb274aaf6834501563a0 to your computer and use it in GitHub Desktop.
Python funciton for getting a current timestamp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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