Global Feed Post Login
Replying to Avatar Nice and Kind Vic

Make it a function like this. I remove the "days" string as I have more uses without it in scripts. Also simplified seconds per day

dayssince () {

echo $((($(date +%s)-$(date +s --date "$1"))/(86400)))

}

You can put that in your ~/.bashrc or other scripts loaded from such to simply call

dayssince 1979-05-28

If you want the "days" string, can call

printf "%d days" $(dayssince 1979-05-28)

Avatar
rejon 2y ago

Nice! Yes, I have something similar ;)

Reply to this note

Please Login to reply.

Discussion

No replies yet.