douxiexie3574 2017-05-15 16:23
浏览 78
已采纳

更改时间。时区,无需重新解析

I am dealing with time.Time objects that has been parsed with the wrong timezone. They internally have a UTC tz but the original data come from a legacy MySQL database that internally store datetimes with the timezone Europe/Paris.

I would like to change the internal timezone of the time without reparsing it. I have tried the time.In() function but it does not solve my use case because it return the same time for another timezone.

My ultimate solution would be to use https://golang.org/pkg/time/#ParseInLocation to recreate the date from the value of the original with the proper location. However if this could be avoided this would be better.

Any thoughts ?

Thanks.

  • 写回答

1条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥15 unity 使用 Vuforia 导入Model target 成功后database下拉菜单不显示导入的内容
      • ¥15 VBA跨工作簿获取目标工作簿内已有数据的列号
      • ¥30 Dijkstra‘s 最短路径
      • ¥15 在线教育培训平台,主要以点播视频和在线练习测试为主,除将视频做切片外,有其他哪种方式降低流量?(关键词-带宽速率)
      • ¥20 用c语音或c++实现银行叫号系统
      • ¥15 人工智能 规则正向演绎和推理
      • ¥20 基于STM32F401的电子密码锁设计
      • ¥15 famamacbeth回归中遇到only size-1 arrays can be converted to Python scalars,求解答
      • ¥15 单片机多个自锁按键的编程实践
      • ¥15 用python操作redis存储中文后,再取出的数据变成了乱码怎么办?