LocalDate

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2022 License: BSD-2-Clause, ISC Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DTF_YMD        = "2006-01-02"
	DTF_YM         = "2006_01"
	BeiJinAreaTime = "Asia/Shanghai"
)

Variables

This section is empty.

Functions

func AddDate

func AddDate(t time.Time, years int, months int) time.Time

AddDate 时间增减 类似于ruby中的时间增减,和 time.AddDate 不同 如: loc, _ := time.LoadLocation("Asia/Shanghai") t := time.Date(2010, 3, 31, 12, 0, 0, 0, loc) utils.AddDate(t, 0, 1) => 2010-04-30 12:00:00 +0800 CST 不会因为4月没有31号,而变成5月1号

func GetBjTimeLoc

func GetBjTimeLoc() *time.Location

Types

type LocalDate

type LocalDate time.Time

func ConvertStringToLocalDate

func ConvertStringToLocalDate(src string, f string) *LocalDate

func Now

func Now() *LocalDate

func Parse

func Parse(str string, f string) *LocalDate

func (LocalDate) Format

func (t LocalDate) Format(fmt string) string

func (*LocalDate) IsAfter

func (t *LocalDate) IsAfter(t2 *LocalDate) bool

func (*LocalDate) IsBefore

func (t *LocalDate) IsBefore(t2 *LocalDate) bool

func (*LocalDate) IsEqual

func (t *LocalDate) IsEqual(t2 *LocalDate) bool

func (LocalDate) MarshalJSON

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

func (*LocalDate) MinusDays

func (t *LocalDate) MinusDays(d int) (t2 *LocalDate)

func (*LocalDate) MinusMonths

func (t *LocalDate) MinusMonths(m int) (t2 *LocalDate)

func (*LocalDate) PlusDays

func (t *LocalDate) PlusDays(d int) (t2 *LocalDate)

func (*LocalDate) Scan

func (t *LocalDate) Scan(v interface{}) error

func (LocalDate) String

func (t LocalDate) String() string

func (*LocalDate) ToEpochDay

func (t *LocalDate) ToEpochDay() (days int)

func (*LocalDate) UnmarshalJSON

func (t *LocalDate) UnmarshalJSON(data []byte) (err error)

func (LocalDate) Value

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

Jump to

Keyboard shortcuts

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