Skip to content

Instantly share code, notes, and snippets.

@yyano
Last active November 26, 2017 02:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yyano/82467d30b0260a1acf76169ad8d49597 to your computer and use it in GitHub Desktop.
Save yyano/82467d30b0260a1acf76169ad8d49597 to your computer and use it in GitHub Desktop.
Go言語で日付のループ処理。2015年12月01日から今日までを1日ずつ表示する。 Loop by date.(from 01 dec 2015, to Today)
package main
import (
"log"
"time"
)
func main() {
time.Parse("2006-01-02", "2015-12-01")
for d := fromDate; d.Unix() < time.Now().Unix(); d = d.AddDate(0, 0, 1) {
log.Println(d)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment