编辑代码

package main
import ("fmt";"time")
func main () {
    //JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。
    fmt.Println("Hello world!   -  go.jsrun.net ")
    fmt.Println(time.FixedZone("UTC-8", -8*60*60))
    h,_ := time.ParseDuration("-1h")
    fmt.Println(h)
    fmt.Println(time.Now())
    today:= time.Now().Add(8*h)
    fmt.Println(today)
    today = time.Date(today.Year(), today.Month(), today.Day(), 0, 0, 0, 0, time.FixedZone("UTC-8", -8*60*60))
    fmt.Println(today)
    weekday := int(time.Monday - today.Weekday())
    fmt.Println(time.Monday)
    fmt.Println(today.Weekday())
    fmt.Println(weekday)

    fmt.Println(int(time.Monday - time.Sunday))

    pastWeek:=today.AddDate(0,0,-6)
    fmt.Println(pastWeek)
    pastWeek = time.Date(pastWeek.Year(), pastWeek.Month(), pastWeek.Day(), 0, 0, 0, 0, time.FixedZone("UTC-8", -8*60*60))
    fmt.Println(pastWeek)

    fmt.Println(today.Day())
    pastMonth := today.AddDate(0, 0, 1-today.Day())
    fmt.Println(pastMonth)
	pastMonth = time.Date(pastMonth.Year(), pastMonth.Month(), pastMonth.Day(), 0, 0, 0, 0, time.FixedZone("UTC-8", -8*60*60))
    fmt.Println(pastMonth)
}