I realize I could whip up a little C or Ruby program to do this, but I want my script to have as few dependencies as possible.
Given that caveat, how does one d
You might be looking for this. gdate '+%s' -d '2 weeks ago'
or gdate '+%s' -d '1 day ago'
These two examples return in the Epoch time. I turn those seconds in to something my language can read normal strptime(seconds, '%s')
. Python Ruby and Javascript are the few I know have it. I am sure Java and all the others do as well.
Also gdate
is date (GNU coreutils) it just called something different on mac. Strange thing is on my other mac it let me use just data
to get this same off set. Don't know why might be they change something recently.