Skip to content

Instantly share code, notes, and snippets.

@knoxilla
Created February 25, 2022 16:11
Show Gist options
  • Select an option

  • Save knoxilla/249990f2e5ac7f6148b7c3301975f07f to your computer and use it in GitHub Desktop.

Select an option

Save knoxilla/249990f2e5ac7f6148b7c3301975f07f to your computer and use it in GitHub Desktop.

Revisions

  1. knoxilla created this gist Feb 25, 2022.
    21 changes: 21 additions & 0 deletions mdate,py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    #!/usr/bin/env python3
    """Endless March"""

    from datetime import datetime
    import subprocess

    actual_date = subprocess.run("date",capture_output=True, text=True)
    actual_date_parts = actual_date.stdout.split()

    today = datetime.now()
    then = datetime(day=1, month=3, year=2020)

    timedelta = today - then

    actual_date_parts[1] = 'Mar'
    actual_date_parts[2] = f"{timedelta.days + 1}"
    actual_date_parts[5] = '2020'

    tweaked_date = " ".join(actual_date_parts)

    print(tweaked_date)