Skip to content

Instantly share code, notes, and snippets.

@islishude
Created June 23, 2020 11:40
Show Gist options
  • Save islishude/02ec5646185fb891be0d2e889b8fea4d to your computer and use it in GitHub Desktop.
Save islishude/02ec5646185fb891be0d2e889b8fea4d to your computer and use it in GitHub Desktop.
get beginning of today and tomorrow
package main
import (
"fmt"
"time"
)
func main() {
t := time.Now()
y, m, d := t.Date()
today := time.Date(y, m, d, 0, 0, 0, 0, t.Location())
tomorrow := today.AddDate(0, 0, 1)
fmt.Println(today)
fmt.Println(tomorrow)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment