I am trying to do date computations in a shell script using gnu date with timestamp phrases and fail to explain these differences. Can someone enlighten me? Is this a bug?
% date -u -d "now"
Fri Aug 2 15:07:16 UTC 2013
% date -u -d "1970-01-01 00:00:00 UTC + `date +%s` seconds"
Fri Aug 2 15:07:29 UTC 2013
% date -u -d "now -6 months -1 day"
Fri Feb 1 15:07:52 UTC 2013
% date -u -d "1970-01-01 00:00:00 UTC + `date +%s` seconds -6 months -1 day"
Tue Jan 29 15:08:03 UTC 2013
I expected the last one to mean exactly the same as the the one before since %s is defined as "seconds since 1970-01-01 00:00:00 UTC" in the manpage.