Created
June 23, 2020 11:40
-
-
Save islishude/02ec5646185fb891be0d2e889b8fea4d to your computer and use it in GitHub Desktop.
get beginning of today and tomorrow
This file contains hidden or 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" | |
) | |
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