Skip to content

Instantly share code, notes, and snippets.

@178inaba
Created January 6, 2020 07:17
Show Gist options
  • Select an option

  • Save 178inaba/8a1d0e9353c14c4aa3e3d603e1166d7e to your computer and use it in GitHub Desktop.

Select an option

Save 178inaba/8a1d0e9353c14c4aa3e3d603e1166d7e to your computer and use it in GitHub Desktop.
year, month increment.
package main
import (
"fmt"
"time"
)
func main() {
t := time.Now()
for i := 0; i < 100; i++ {
fmt.Println(t.Year(), t.Month())
t = t.AddDate(0, 1, 0)
fmt.Println(t)
fmt.Println(t.Year(), t.Month())
fmt.Println("----------------------------------------------")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment