mirror of
https://gitee.com/shikong-sk/golang-study
synced 2025-02-23 15:32:15 +08:00
26 lines
417 B
Go
26 lines
417 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
func f1() {
|
|
now := time.Now()
|
|
fmt.Println(now)
|
|
|
|
loc, err := time.LoadLocation("Asia/Shanghai")
|
|
if err != nil {
|
|
fmt.Printf("Load Location Failed, err => %s", err)
|
|
return
|
|
}
|
|
fmt.Println("时区:", loc)
|
|
|
|
str, _ := time.ParseInLocation("2006-01-02 15:04:05.999", now.Add(24*time.Hour).Format("2006-01-02 15:04:05.999"), loc)
|
|
fmt.Println(str)
|
|
}
|
|
|
|
func main() {
|
|
f1()
|
|
}
|