timex

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	YMD         = "2006-01-02"     //2006-01-02
	Layout      = time.Layout      //01/02 03:04:05PM '06 -0700 The reference time, in numerical order.
	ANSIC       = time.ANSIC       //Mon Jan _2 15:04:05 2006
	UnixDate    = time.UnixDate    //Mon Jan _2 15:04:05 MST 2006
	RubyDate    = time.RubyDate    //Mon Jan 02 15:04:05 -0700 2006
	RFC822      = time.RFC822      //02 Jan 06 15:04 MST
	RFC822Z     = time.RFC822Z     //02 Jan 06 15:04 -0700 RFC822 with numeric zone
	RFC850      = time.RFC850      //Monday, 02-Jan-06 15:04:05 MST
	RFC1123     = time.RFC1123     //Mon, 02 Jan 2006 15:04:05 MST
	RFC1123Z    = time.RFC1123Z    //Mon, 02 Jan 2006 15:04:05 -0700 RFC1123 with numeric zone
	RFC3339     = time.RFC3339     //2006-01-02T15:04:05Z07:00
	RFC3339Nano = time.RFC3339Nano //2006-01-02T15:04:05.999999999Z07:00
	Kitchen     = time.Kitchen     //3:04PM
	Stamp       = time.Stamp       //Jan _2 15:04:05
	StampMilli  = time.StampMilli  //Jan _2 15:04:05.000
	StampMicro  = time.StampMicro  //Jan _2 15:04:05.000000
	StampNano   = time.StampNano   //Jan _2 15:04:05.000000000
)

Variables

View Source
var WeekXingQi = map[string]string{
	"Monday":    "星期一",
	"Tuesday":   "星期二",
	"Wednesday": "星期三",
	"Thursday":  "星期四",
	"Friday":    "星期五",
	"Saturday":  "星期六",
	"Sunday":    "星期日",
}
View Source
var WeekZhou = map[string]string{
	"Monday":    "周一",
	"Tuesday":   "周二",
	"Wednesday": "周三",
	"Thursday":  "周四",
	"Friday":    "周五",
	"Saturday":  "周六",
	"Sunday":    "周日",
}

Functions

func AtToday

func AtToday(timestamp int64) bool

AtToday Check timestamp is in today time range

func CFormat

func CFormat(layout string) string

CFormat Current time format

func Format

func Format(timestamp int64, layout string) string

Format Any time format

func IsFormattedDate

func IsFormattedDate(date, format string) bool

IsFormattedDate Determine the date is input format

func ParseT

func ParseT(dt, layout string, compatible ...bool) *time.Time

func Time

func Time(timestamp int64) time.Time

Time Any timestamp to time

func Week

func Week(timestamp int64, weekMap map[string]string) string

Week Any timestamp to chinese week

func Zero

func Zero(timestamp ...int64) int64

Zero Any(Current) timestamp's zero time at that(to-) day

Types

type T

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

func After

func After(duration time.Duration) *T

After Return the Time From Now After Duration

func CMs

func CMs() *T

CMs Current MicroSecond

func CNs

func CNs() *T

CNs Current NanoSecond

func CUs

func CUs() *T

CUs Current MilliSecond

func Cs

func Cs() *T

Cs Current Second

func Parse

func Parse(dt, layout string, compatible ...bool) *T

func (*T) Bytes

func (t *T) Bytes() []byte

func (*T) Float32

func (t *T) Float32() float32

func (*T) Float64

func (t *T) Float64() float64

func (*T) Int

func (t *T) Int() int

func (*T) Int64

func (t *T) Int64() int64

func (*T) String

func (t *T) String() string

Jump to

Keyboard shortcuts

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