Skip to content

Instantly share code, notes, and snippets.

@SymonRod
Last active October 25, 2021 08:45
Show Gist options
  • Save SymonRod/6ae16851e7bd7236ca1fda74554b50f7 to your computer and use it in GitHub Desktop.
Save SymonRod/6ae16851e7bd7236ca1fda74554b50f7 to your computer and use it in GitHub Desktop.

Revisions

  1. SymonRod revised this gist Oct 25, 2021. 1 changed file with 18 additions and 1 deletion.
    19 changes: 18 additions & 1 deletion datetime_now.py
    Original file line number Diff line number Diff line change
    @@ -1 +1,18 @@
    ‎‎​
    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)
  2. SymonRod created this gist Oct 25, 2021.
    1 change: 1 addition & 0 deletions datetime_now.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    ‎‎​