Skip to content

Instantly share code, notes, and snippets.

@knoxilla
Created February 25, 2022 16:11
Show Gist options
  • Save knoxilla/249990f2e5ac7f6148b7c3301975f07f to your computer and use it in GitHub Desktop.
Save knoxilla/249990f2e5ac7f6148b7c3301975f07f to your computer and use it in GitHub Desktop.
mdate - Endless March
#!/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)
@knoxilla
Copy link
Author

$ mdate
Fri Mar 727 11:12:24 EST 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment