79555082

Date: 2025-04-04 10:40:22
Score: 1.5
Natty:
Report link

you can try https://github.com/timematic/anytime

func main() {
    datetime, err := anytime.Parse("2006-01-02T15:04:05")
    if err != nil {
        panic(err)
    }
    fmt.Println(datetime) // 2006-01-02 15:04:05 +0000 UTC

    loc, _ := time.LoadLocation("America/New_York")
    datetime, err = anytime.ParseInLocation("2006-01-02T15:04:05", loc)
    if err != nil {
        panic(err)
    }
    fmt.Println(datetime) // 2006-01-02 15:04:05 -0500 EST
}
Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: 7loongman