Last active
March 11, 2023 02:40
-
-
Save mbbx6spp/38cb62f2fc654a684bb55096a91a4e42 to your computer and use it in GitHub Desktop.
Only shows in UTC because timezones are bullshit and I needed to pick one. Sorry. It is what my servers use.
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
#!/usr/bin/env bash | |
main() { | |
local -ri mar_end=1583042400 | |
local -ri today="$(date +"%s")" | |
local -r dow="$(date -u +"%a")" | |
local -r time="$(date -u +"%T")" | |
local -ri secs=86400 | |
local -ri days_since="$(( ((${today} - ${mar_end}) / ${secs}) + 1 ))" | |
echo "${dow} ${days_since} March 2020 ${time} UTC" | |
} | |
set -euo pipefail | |
main |
Fixed so it should run on macOS thanks to lambdagrrl on Twitter.
date +%a gets you short day name, versus the case. available in both gnu and bsd date
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output looks like: