golang中用于存储日期时间偏移量的数据类型

Ais*_*nan 5 postgresql datetime json go

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?

Elw*_*nar 2

time.Time结构了解时区,并且应该由大多数可用的 SQL 驱动程序正确处理。

唯一需要补充的是,大多数系统中的约定是仅使用交换格式(JSON、SQL 等)的 UTC 日期,并在必要时让应用程序切换到时区。