Skip to content

Instantly share code, notes, and snippets.

@178inaba
Created January 6, 2020 05:24
Show Gist options
  • Save 178inaba/8cbce2d3546d59e66455d4b03b27d300 to your computer and use it in GitHub Desktop.
Save 178inaba/8cbce2d3546d59e66455d4b03b27d300 to your computer and use it in GitHub Desktop.
year, month increment.
package main
import (
"fmt"
"time"
)
func main() {
y, m := 2019, time.Month(10)
for i := 0; i < 100; i++ {
fmt.Println(y, m)
t := time.Date(y, m+1, 1, 0, 0, 0, 0, time.UTC)
fmt.Println(t)
y, m, _ = t.Date()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment