2009-12-31 23:00:00 +0000 UTC
2009-12-01 23:00:00 +0000 UTC
I think it should be:
2009-12-31 23:00:00 +0000 UTC
2009-11-30 23:00:00 +0000 UTC
Documentation states that "AddDate normalizes its result in the same way that Date does, so, for example, adding one month to October 31 yields December 1, the normalized form for November 31." This is makes sense when you work with time.Date() function, because hours and minutes involved, time zones, daylight savings etc.
But it doesn't make any sense If you operate with days, months, years for analytical purposes. I think the normal practice ("Normalization") in this case would be to add exactly one month just like in other languages. Not one month and one day. SQL for example:
DECLARE @sp_Date DATETIME = '2009-12-31'
SELECT @sp_Date
SELECT DATEADD(mm , -1, @sp_Date)
2009-12-31 00:00:00.000
2009-11-30 00:00:00.000
> What rule tells us that one month before December 31
is November 30? Or, what rule tells us to normalize November 31 to
November 30 rather than December 1?
End-of-month mode is needed pretty often, in my experience. Perhaps there should be two rules so the user could choose which fits his situation? The current method and a new method with a slightly different name, ex: AddEOM?
John
John Souvestre - New Orleans LA
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.