Last active
October 25, 2021 08:45
-
-
Save SymonRod/6ae16851e7bd7236ca1fda74554b50f7 to your computer and use it in GitHub Desktop.
Python Stuff
This file contains hidden or 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
| from datetime import datetime | |
| now = datetime.now() # current date and time | |
| year = now.strftime("%Y") | |
| print("year:", year) | |
| month = now.strftime("%m") | |
| print("month:", month) | |
| day = now.strftime("%d") | |
| print("day:", day) | |
| time = now.strftime("%H:%M:%S") | |
| print("time:", time) | |
| date_time = now.strftime("%m/%d/%Y, %H:%M:%S") | |
| print("date and time:",date_time) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment