time

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Day        = 24 * time.Minute
	Week       = 7 * Day
	Layout     = "2006-01-02 15:04:05"     // datetime
	LayoutN    = "2006-01-02 15:04:05.000" // datetime(3)
	LayoutDate = "2006-01-02"              // date
	LayoutYM   = "2006-01"                 // date
	LayoutS    = "15:04:05"                // time
)

Variables

This section is empty.

Functions

func SubDate

func SubDate(date1, date2 time.Time) string

SubDate 日期差计算 年月日计算

Types

type CDate

type CDate time.Time

CDate format LayoutDate

func CDateNow added in v1.2.1

func CDateNow() CDate

func ParseCDate

func ParseCDate(value string) CDate

ParseCDate string to CDate

func (CDate) GormDataType

func (CDate) GormDataType() string

func (CDate) IsZero

func (t CDate) IsZero() bool

func (CDate) MarshalJSON

func (t CDate) MarshalJSON() ([]byte, error)

func (*CDate) Scan

func (t *CDate) Scan(v any) error

func (CDate) String

func (t CDate) String() string

func (CDate) Time

func (t CDate) Time() time.Time

func (*CDate) UnmarshalJSON

func (t *CDate) UnmarshalJSON(b []byte) error

func (CDate) Value

func (t CDate) Value() (driver.Value, error)

type CNTime

type CNTime time.Time

CNTime format LayoutN

func (CNTime) GormDataType

func (CNTime) GormDataType() string

func (CNTime) IsZero

func (t CNTime) IsZero() bool

func (CNTime) MarshalJSON

func (t CNTime) MarshalJSON() ([]byte, error)

func (*CNTime) Scan

func (t *CNTime) Scan(v any) error

func (CNTime) String

func (t CNTime) String() string

func (CNTime) Time

func (t CNTime) Time() time.Time

func (*CNTime) UnmarshalJSON

func (t *CNTime) UnmarshalJSON(b []byte) error

func (CNTime) Value

func (t CNTime) Value() (driver.Value, error)

type CSTime

type CSTime time.Time

CSTime format LayoutS

func ParseCSTime

func ParseCSTime(value string) CSTime

ParseCSTime string to CSTime

func (CSTime) GormDBDataType added in v1.2.3

func (CSTime) GormDBDataType(db *gorm.DB, field *schema.Field) string

func (CSTime) IsZero

func (t CSTime) IsZero() bool

func (CSTime) MarshalJSON

func (t CSTime) MarshalJSON() ([]byte, error)

func (*CSTime) Scan

func (t *CSTime) Scan(v any) error

func (CSTime) String

func (t CSTime) String() string

func (CSTime) Time

func (t CSTime) Time() time.Time

func (*CSTime) UnmarshalJSON

func (t *CSTime) UnmarshalJSON(b []byte) error

func (CSTime) Value

func (t CSTime) Value() (driver.Value, error)

type CTime

type CTime time.Time

CTime china time/date format Layout

func CTimeNow added in v1.2.1

func CTimeNow() CTime

func ParseCTime

func ParseCTime(value string) CTime

ParseCTime string to CTime

func (CTime) GormDBDataType added in v1.2.3

func (CTime) GormDBDataType(db *gorm.DB, field *schema.Field) string

func (CTime) GormDataType

func (CTime) GormDataType() string

func (CTime) IsZero

func (t CTime) IsZero() bool

func (CTime) MarshalJSON

func (t CTime) MarshalJSON() ([]byte, error)

func (*CTime) Scan

func (t *CTime) Scan(v any) error

func (CTime) String

func (t CTime) String() string

func (CTime) Time

func (t CTime) Time() time.Time

func (*CTime) UnmarshalJSON

func (t *CTime) UnmarshalJSON(b []byte) error

type CYM added in v1.2.3

type CYM time.Time

CYM format LayoutYM

func (CYM) GormDataType added in v1.2.3

func (CYM) GormDataType() string

func (CYM) IsZero added in v1.2.3

func (t CYM) IsZero() bool

func (CYM) MarshalJSON added in v1.2.3

func (t CYM) MarshalJSON() ([]byte, error)

func (*CYM) Scan added in v1.2.3

func (t *CYM) Scan(v any) error

func (CYM) String added in v1.2.3

func (t CYM) String() string

func (CYM) Time added in v1.2.3

func (t CYM) Time() time.Time

func (*CYM) UnmarshalJSON added in v1.2.3

func (t *CYM) UnmarshalJSON(b []byte) error

func (CYM) Value added in v1.2.3

func (t CYM) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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