duanboniao5903 2017-02-25 01:44
浏览 57
已采纳

如何以特殊格式在golang中解析日期时间?

I has a special time string like this: February 24, 2017 , 1:44 pm and want to translate it to a golang time.Time object, does anyone know how to do this work. I have tried to using time.Parse(), but always got errors.

Thanks.

  • 写回答

2条回答 默认 最新

  • dongwen2896 2017-02-25 01:54
    关注

    Use the format string January 2, 2006 , 3:04 pm to parse that kind of string.

    Example: https://play.golang.org/p/4HgRekLr-7

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
  • douliexu5623 2017-02-27 10:15
    关注

    Read https://golang.org/pkg/time/#pkg-constants to know how to define your own formats or use predefined formates.

    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 我需要在PC端 开两个抖店工作台客户端.(语言-java)
  • ¥15 有没有哪位厉害的人可以用C#可视化呀
  • ¥15 可以帮我看看代码哪里错了吗
  • ¥15 设计一个成绩管理系统
  • ¥15 PCL注册的选点等函数如何取消注册
  • ¥15 问一下各位,为什么我用蓝牙直接发送模拟输入的数据,接收端显示乱码呢,米思齐软件上usb串口显示正常的字符串呢?
  • ¥15 Python爬虫程序
  • ¥15 crypto 这种的应该怎么找flag?
  • ¥15 代码已写好,求帮我指出错误,有偿!
  • ¥15 matlab+波形匹配算法