This is a creation in Article, where the information may have evolved or changed.
Recently encountered a small problem in the project, need to get the date of the day 0 time, with Golang implementation, review the relevant data implementation methods are as follows:
Package Main
Import (
"FMT"
"Time"
)
Get 0 points on the day
Func Main () {
TIMESTR: = time. Now (). Format ("2006-01-02")
Fmt. Println ("Timestr:", Timestr)
T, _: = time. Parse ("2006-01-02", Timestr)
Timenumber: = T.unix ()
Fmt. Println ("Timenumber:", Timenumber)
}
The results of the operation are as follows:
It is worth mentioning that the value of the Timenumber timestamp is not 0, but 8:00 of the time of the morning.
Therefore, it is necessary to subtract the time stamp value of eight hours on this basis for the 0 point of the day.
So the corresponding 0-point timestamp for the day is 1469808000.