1. 程式人生 > >Golang JSON Unmarshal MySQL datetime to time.Time

Golang JSON Unmarshal MySQL datetime to time.Time

json.Unmarshal uses RFC3339 to decode MySQL datetime type into time.Time.

Json snippet

"Datetime": "2017-07-06T17:27:00Z"

Wrong

"Datetime": "2017-07-06 17:27:00"

or

"Datetime": "2017-07-06T17:27:00"

Reference