I am using go language to develop an application. In my program I receive a JSON data which contains an entity in date time offset format for example DateTime": "2014-10-19T23:08:24Z"
I need to unmarshal the JSON and store it in the database in the TIMESTAMP(p) WITH TIME ZONE format in PostgreSQL database. When I unmarshal, I need to store this in a variable of the same data type.
Is there a data type available in Golang to do this or any other means of doing this?
The time.Time
struct is aware of the timezone, and should be properly handled by most of the SQL drivers available.
The only thing to add is that the convention in most systems is to use only UTC dates in exchange formats (JSON, SQL, etc) and let the application shift to timezone when necessary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With