jq is useful to slice, filter, map and transform structured json data.
brew install jq
This is a compiled list of falsehoods programmers tend to believe about working with time.
Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.