search
  • Sign In
  • Sign Up
Password reset successful

Follow the proiects vou are interested in andi aet the latestnews about them taster

0 answers
Q&A time.Parse behaviour
time.Parse behaviour
P粉546257913 2025-12-29 11:22:09 Views 114

0

In Go, while trying to convert string to time.Time, using time package's Parse method doesn't return expected result. It seems problem is with the timezone. I want to change to ISO 8601 combined with date and time in UTC.

package main

import (
    "fmt"
    "time"
)

func main() {
    const longForm = "2013-05-13T18:41:34.848Z"
    //even this is not working
    //const longForm = "2013-05-13 18:41:34.848 -0700 PDT"
    t, _ := time.Parse(longForm, "2013-05-13 18:41:34.848 -0700 PDT")
    fmt.Println(t)
    //outputs 0001-01-01 00:00:00 +0000 UTC
}

thanks in advance!

Your Answer
submit

0 answers

Popular tool

vc9-vc14 (32+64 bit) runtime library collection (link below)

vc9-vc14 (32+64 bit) runtime library collection (link below)

Download the collection of runtime libraries required for phpStudy installation

VC9 32-bit

VC9 32-bit

VC9 32-bit phpstudy integrated installation environment runtime library

PHP programmer toolbox full version

PHP programmer toolbox full version

Programmer Toolbox v1.0 PHP Integrated Environment

VC11 32-bit

VC11 32-bit

VC11 32-bit phpstudy integrated installation environment runtime library

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use