3 ms·
I know this is not in the spirit of the article, but getting the number of weeks is quite useful generally. One can do this with the standard date util like:
by pixelbeat__ 5y ago
I know this is not in the spirit of the article, but getting the number of weeks is quite useful generally.
One can do this with the standard date util like:
$ echo $(((($(date +%s -d 'Aug 31') - $(date +%s -d 'Jul 1'))/(60*60*24*7))))
8 # 8.7 weeks truncated
$ echo $(((($(date +%W -d 'Aug 31') - $(date +%W -d 'Jul 1')))))
9
It's useful to get the number of weeks from git logs for release notes etc., which can be done like:
oldvs='v1.0'
oldts=$(git log -n1 --format="%at" "$oldvs")
weeks=$((($(date +%s) - $oldts)/(60*60*24*7)))