datetime

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SecondsISO8601 display = iota
	MillisecondsISO8601
	ISO8601
	UnixTimestamp
	MillisecondsTimestamp
	Custom
)

默认支持的显示类型

Variables

This section is empty.

Functions

This section is empty.

Types

type DateTime

type DateTime struct {
	time.Time
	Display display
	Format  string
}

DateTime 时间类型

func New

func New(value time.Time) *DateTime

New 创建时间

func Now

func Now() *DateTime

Now 当前时间

func Parse

func Parse(value string, formatters ...string) (*DateTime, error)

Parse 解析时间字符串

func ParseInTimezone

func ParseInTimezone(value string, timezone string, formatters ...string) (*DateTime, error)

Parse 解析时间字符串

func (DateTime) MarshalJSON

func (ins DateTime) MarshalJSON() ([]byte, error)

MarshalJSON 转

func (DateTime) MarshalText added in v1.0.2

func (ins DateTime) MarshalText() ([]byte, error)

func (*DateTime) Scan

func (ins *DateTime) Scan(value interface{}) error

Scan database/sql Scan 接口实现

func (*DateTime) SetDisplay

func (ins *DateTime) SetDisplay(option display) *DateTime

SetDisplay 设置输出类型

func (*DateTime) SetFormat

func (ins *DateTime) SetFormat(format string) *DateTime

SetFormat 设置输出格式

func (*DateTime) SetTimezone

func (ins *DateTime) SetTimezone(name string) *DateTime

SetTimezone 设置时区

func (*DateTime) UnmarshalJSON

func (ins *DateTime) UnmarshalJSON(input []byte) error

UnmarshalJSON 转换 JSON

func (*DateTime) UnmarshalText added in v1.0.2

func (ins *DateTime) UnmarshalText(input []byte) error

func (DateTime) Value

func (ins DateTime) Value() (driver.Value, error)

Value database/sql Value 接口实现

Jump to

Keyboard shortcuts

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