If it's February 28 and I'm at my barber scheduling my next monthly appointment he surely isn't going to suggest April 3. =)
Frank From: Andrew Hume [mailto:and...@research.att.com] Sent: Thursday, May 31, 2012 9:43 AM To: Singer X.J. Wang Cc: frnk...@iname.com; Tech@lists.lopsa.org Subject: Re: [lopsa-tech] Date function seems assume 30-day month really? how about the correct answer? unlike many date questions, this seems really clear: go back one in the month dimension if this leaves you at an invalid day, then go to nearest valid day (break ties any way you like). On May 31, 2012, at 7:37 AM, Singer X.J. Wang wrote: Well, 30 days is a much better approximation then 2 fortnights. Okay, lets ask another question. What do you propose? thanks, Singer On Thu, May 31, 2012 at 10:32 AM, Frank Bulk <frnk...@iname.com> wrote: True, no April 31st, but there's an April 30. =) I don't understand why it's OK to assume a 30-day month. If someone wants 30 days then just do a "date -d '-30 days'" -- one could just as well assume the 1 month is 4 weeks or two fortnights. Frank -----Original Message----- From: Jonathan [mailto:lo...@redigloo.org] Sent: Thursday, May 31, 2012 9:30 AM To: frnk...@iname.com Cc: Tech@lists.lopsa.org Subject: Re: [lopsa-tech] Date function seems assume 30-day month "Thirty days hath September, April, June and November..." There is no 31st April. $ date -d '-1 month' Tue May 1 15:28:44 BST 2012 $ date -d '-2 month' Sat Mar 31 15:28:52 BST 2012 Jonathan. On 31/05/12 15:22, Frank Bulk wrote: > I noticed a daily script was giving out some incorrect output, and looking > at it more closely I saw that the date function assumes a 30-day month: > > nagios:/# date > Thu May 31 09:22:02 CDT 2012 > nagios:/#nagios:/# date -d '-1 month' > Tue May 1 09:19:54 CDT 2012 > nagios:/# > > Shouldn't the output be April 31st? > > Frank > > > > _______________________________________________ > Tech mailing list > Tech@lists.lopsa.org > https://lists.lopsa.org/cgi-bin/mailman/listinfo/tech > This list provided by the League of Professional System Administrators > http://lopsa.org/ -- Jonathan Crompton _______________________________________________ Tech mailing list Tech@lists.lopsa.org https://lists.lopsa.org/cgi-bin/mailman/listinfo/tech This list provided by the League of Professional System Administrators http://lopsa.org/ -- Try Pythian managed services risk-free for operational support, upgrades/migrations, special projects or increased performance. _______________________________________________ Tech mailing list Tech@lists.lopsa.org https://lists.lopsa.org/cgi-bin/mailman/listinfo/tech This list provided by the League of Professional System Administrators http://lopsa.org/ ------------------ Andrew Hume (best -> Telework) +1 623-551-2845 and...@research.att.com (Work) +1 973-236-2014 AT&T Labs - Research; member of USENIX and LOPSA
_______________________________________________ Tech mailing list Tech@lists.lopsa.org https://lists.lopsa.org/cgi-bin/mailman/listinfo/tech This list provided by the League of Professional System Administrators http://lopsa.org/