基本介绍

通用时间管理模块,封装了常用的时间/日期相关的方法,作为标准库time的功能性扩展,提供了更多的功能特性。支持自定义的日期格式化语法,格式化语法灵感来源于PHPdate函数语法 ( http://php.net/manual/zh/function.date.php )。

gtime的时间格式语法对于熟悉PHP的开发者来说非常友好。

使用方式

import "github.com/gogf/gf/v2/os/gtime"

接口文档

https://pkg.go.dev/github.com/gogf/gf/v2/os/gtime

相关文档




Content Menu

  • No labels

4 Comments

  1. 你好,

    2022/2/7 9:00:00

    这种小时前面没有0的字符串时间格式,转换的时候后是

    2022/2/7 900000

    但是实际应该为

    2022/2/7 090000

    这种情况是否考虑修复?


  2. 我用go-zero框架,想使用gf里面某些工具方法,  下载后直接报错, 无法启动原有程序。

    # go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig
    C:\Users\Administrator\go\pkg\mod\go.opentelemetry.io\otel\exporters\otlp\otlptrace@v1.14.0\internal\otlpconfig\options.go:100:62: undefined: internal.GetUserAgentHeader

    是不支持第三方框架引用吗?


    1. 看起来似乎是第三方包写得有问题呢。

  3. 时间处理可以试下 carbon