ktime

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GoTimeFormat             = "2006-01-02 15:04:05"
	GoDateFormat             = "2006-01-02"
	GoDateFormatOblique      = "2006/01/02"
	GoHourMinuteSecondFormat = "15:04:05"
)

*

  • 时间处理类

Variables

This section is empty.

Functions

func After

func After(d time.Duration) <-chan time.Time

After ...

func Duration

func Duration(str string) time.Duration

Duration ... panic if parse duration failed

func Elapse

func Elapse(f func()) int64

Timing the cost of function call, unix nano was returned

func GetCurentDateTimeStamp

func GetCurentDateTimeStamp(time time.Time) int

func GetCurrentStringTime

func GetCurrentStringTime() string

*

  • 返回当前时间
  • @return 2019-01-07 11:05:48

func GetTimestampInMilli

func GetTimestampInMilli() int64

GetTimestampInMilli ...

func IsLeapYear

func IsLeapYear(year int) bool

IsLeapYear ...

func NewRashTimer

func NewRashTimer(tick time.Duration) *rashTimer

NewRashTimer is the time for a jiffies

func Sleep

func Sleep(d time.Duration)

Sleep ...

func StringToDate

func StringToDate(timeStr string) time.Time

*

  • 把日期字符串转成时间类型
  • 输入字符串
  • @param timeStr 2019-01-07
  • @return 2019-01-07 11:05:48

func StringToDateStamp

func StringToDateStamp(timeStr string) int64

*

  • 把string类型时间转time.Time
  • @timeStr 2019-01-07
  • @return

func StringToTime

func StringToTime(timeStr string) time.Time

*

  • 把日期字符串转成整时间类型
  • 输入字符串
  • @param timeStr 2019-01-07
  • @return 2019-01-07 11:05:48

func StringToTimeStamp

func StringToTimeStamp(timeStr string) int64

*

  • 把时间戳专程字符串类型的时间
  • 输入时间为秒
  • @param timeStr 2019-01-07 11:05:48
  • @return 2019-01-07 11:05:48

func Tick

func Tick(d time.Duration) <-chan time.Time

Tick ...

func TimeStampToStringOnlyDate

func TimeStampToStringOnlyDate(timestamp int64) string

func TimeStampToStringOnlyTime

func TimeStampToStringOnlyTime(timestamp int64) string

func TimeStampToStringTime

func TimeStampToStringTime(timestamp int64) string

*

  • 把时间戳专程字符串类型的时间
  • 输入时间为秒
  • @param timestamp 1546830348
  • @return 2019-01-07 11:05:48

func TimeToStringDate

func TimeToStringDate(timeType time.Time) string

*

  • 把time.Time 类型转成string类型
  • @timeType timeType
  • @return 2019-01-07

func TimeToStringDateOblique

func TimeToStringDateOblique(timeType time.Time) string

*

  • 把time.Time 类型转成string类型
  • @timeType timeType
  • @return 2019/01/07

func TimeToStringTime

func TimeToStringTime(timeType time.Time) string

*

  • 把time.Time 类型转成string类型
  • @timeType timeType
  • @return 2019-01-07 11:05:48

Types

type Ticker

type Ticker struct {
	C <-chan time.Time
	// contains filtered or unexported fields
}

Ticker ...

func NewTicker

func NewTicker(d time.Duration) *Ticker

NewTicker ...

func TickFunc

func TickFunc(d time.Duration, f func()) *Ticker

TickFunc ...

func (*Ticker) Reset

func (t *Ticker) Reset(d time.Duration)

Reset ...

func (*Ticker) Stop

func (t *Ticker) Stop()

Stop ...

type Time

type Time struct {
	time.Time
}

Time time

func Now

func Now() *Time

Now returns current time

func Today

func Today() *Time

Today returns begin time of today

func Unix

func Unix(sec, nsec int64) *Time

Unix returns time converted from timestamp

func (*Time) BeginOfDay

func (t *Time) BeginOfDay() *Time

BeginOfDay returns zero point of time's day

func (*Time) BeginOfHour

func (t *Time) BeginOfHour() *Time

BeginOfHour returns zero point of time's day

func (*Time) BeginOfMinute

func (t *Time) BeginOfMinute() *Time

BeginOfMinute returns zero point of time's day

func (*Time) BeginOfMonth

func (t *Time) BeginOfMonth() *Time

BeginOfMonth begin of month

func (*Time) BeginOfWeek

func (t *Time) BeginOfWeek() *Time

BeginOfWeek the day of begin of week, NOTE: week begin from Sunday

func (*Time) BeginOfYear

func (t *Time) BeginOfYear() *Time

BeginOfYear BeginOfYear beginning of year

func (*Time) EndOfDay

func (t *Time) EndOfDay() *Time

EndOfDay returns last point of time's day

func (*Time) EndOfHour

func (t *Time) EndOfHour() *Time

EndOfHour returns last point of time's day

func (*Time) EndOfMinute

func (t *Time) EndOfMinute() *Time

EndOfMinute returns last point of time's day

func (*Time) EndOfMonth

func (t *Time) EndOfMonth() *Time

EndOfMonth end of month

func (*Time) EndOfWeek

func (t *Time) EndOfWeek() *Time

EndOfWeek end of week NOTE: week end with Saturday

func (*Time) EndOfYear

func (t *Time) EndOfYear() *Time

EndOfYear end of year

type Timer

type Timer struct {
	C <-chan time.Time
	// contains filtered or unexported fields
}

Timer ...

func AfterFunc

func AfterFunc(d time.Duration, f func()) *Timer

AfterFunc ...

func NewTimer

func NewTimer(d time.Duration) *Timer

NewTimer ...

func (*Timer) Reset

func (t *Timer) Reset(d time.Duration)

Reset ...

func (*Timer) Stop

func (t *Timer) Stop()

Stop ...

Jump to

Keyboard shortcuts

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