Created
July 14, 2015 08:03
-
-
Save jmahony/e03ad7a5bbe9822e6b3e to your computer and use it in GitHub Desktop.
Print dates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
var format = "02/01/2006" | |
var incrementInDays = 3 | |
var amountOfDates = 5 | |
func main() { | |
PrintDateEveryNDaysFromToday(incrementInDays, amountOfDates) | |
} | |
func PrintDateEveryNDaysFromToday(incrementInDays, amountOfDates int) { | |
PrintDateEveryNDays(incrementInDays, amountOfDates, time.Now()) | |
} | |
func PrintDateEveryNDays(incrementInDays, amountOfDates int, from time.Time) { | |
for i := 0; i < amountOfDates; i++ { | |
fmt.Println(from.Format(format)) | |
from = from.AddDate(0, 0, incrementInDays) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment