tooltime

package
v0.0.0-...-8371346 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Date

type Date struct {
	// contains filtered or unexported fields
}

日期格式

func NewDate

func NewDate(t time.Time) Date

NewDate 时间转Date类型

func Parse

func Parse(layout, value string) (Date, error)

Parse 字符串解析为Date类型

func (Date) AddDate

func (s Date) AddDate(years int, months int, days int) Date

func (Date) Day

func (s Date) Day() int

func (Date) Format

func (s Date) Format(layout string) string

func (Date) In

func (s Date) In(loc *time.Location) Date

func (Date) Location

func (s Date) Location() *time.Location

func (Date) MarshalText

func (s Date) MarshalText() ([]byte, error)

MarshalText json编码 MarshalText 与 MarshalJson 得区别:如果返回值是一个Json字符串使用MarshalJson,如果返回值不是一个Json字符串使用 MarshalText

func (Date) Month

func (s Date) Month() time.Month

func (*Date) Scan

func (s *Date) Scan(value interface{}) error

Scan 实现 sql.Scanner 接口,对gorm的支持

func (Date) String

func (s Date) String() string

func (*Date) StringToTypeS2m

func (s *Date) StringToTypeS2m(b []byte) error

StringToTypeS2m 这个要实现指针方法不然无法赋值

func (Date) Sub

func (s Date) Sub(u Date) time.Duration

Sub 日期相减 s减u

func (Date) Time

func (s Date) Time() time.Time

func (*Date) TypeToStringS2m

func (s *Date) TypeToStringS2m() ([]byte, error)

TypeToStringS2m 指针非指针方法都行

func (Date) Unix

func (s Date) Unix() int64

秒级别时间戳

func (Date) UnixMilli

func (s Date) UnixMilli() int64

毫秒时间戳

func (*Date) UnmarshalText

func (s *Date) UnmarshalText(b []byte) error

UnmarshalText json解码 这里的s必须是指针

func (Date) Value

func (s Date) Value() (driver.Value, error)

Value 实现 driver.Valuer 接口,对gorm的支持

func (Date) Year

func (s Date) Year() int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL