Timestamp

This commit is contained in:
idanoo 2023-02-13 08:17:12 +13:00
parent 31ad65d711
commit 43514cc0b0
Signed by: idanoo
GPG key ID: 387387CDBC02F132
2 changed files with 1 additions and 21 deletions

20
test.go
View file

@ -1,20 +0,0 @@
package main
import (
"log"
"time"
)
func main() {
localTime, err := time.LoadLocation("Pacific/Auckland")
if err != nil {
log.Fatal(err)
}
// Iterate until Monday!
t := time.Now().In(localTime)
for t.Weekday() != time.Monday {
t = t.AddDate(0, 0, -1)
}
year, month, day := t.Date()
log.Println(time.Date(year, month, day, 0, 0, 0, 0, t.Location()))
}