Yes, that is described (exactly) in the documentation for AddDate:

```
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.
```

On Sun, 2016-10-30 at 20:39 -0700, Mican Zhang wrote:
> as mentioned at subject, i try get last day of next month by AddDate
> from 
> last of current month, but, i got unacceptable result, does anyone
> know 
> this issue?
> 
> 
>   package main
> 
>   import "fmt"
>   import "time"
> 
>   func main() {
>           now := time.Now()
>           fdom := now.AddDate(0, 1, 0)
>           fmt.Printf("now: %s, \nnext month: %s", now, fdom)
>   }
> 
> 
> 
> 
> #+RESULTS:
> : now: 2016-10-31 11:38:26.458479922 +0800 CST, 
> : next month: 2016-12-01 11:38:26.458479922 +0800 CST

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to