Today I was writing a bash script that needed to reference a time in the past relative to the current UTC date.

For instance, if today is March 31st, 2015 UTC, what month was it exactly one month ago?

Answer: February

However, I found it was less than trivial to actually get the correct answer using a relative time calculation with date.

Read more →