xtime

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DateFormat     = "2006-01-02"
	DateTimeFormat = "2006-01-02 15:04:05"
)

Variables

This section is empty.

Functions

func FormatMilliDate added in v1.0.0

func FormatMilliDate(milliseconds int64) string

FormatMilliDate formats Unix timestamp (ms) to date string

func FormatMilliDateTime added in v1.0.0

func FormatMilliDateTime(milliseconds int64) string

FormatMilliDateTime formats Unix timestamp (ms) to time string.

func FormatUnixDate added in v1.0.0

func FormatUnixDate(timestamp int64) string

FormatUnixDate formats Unix timestamp (s) to date string

func FormatUnixDateTime added in v1.0.0

func FormatUnixDateTime(timestamp int64) string

FormatUnixDateTime formats Unix timestamp (s) to time string.

func IsLeap added in v1.0.0

func IsLeap(year int) bool

Types

type Time added in v1.0.0

type Time struct {
	time.Time
}

func Now added in v1.0.0

func Now() *Time

Now return current locale time

func (*Time) BeginOfDay added in v1.0.0

func (t *Time) BeginOfDay() *Time

BeginOfDay return begin time of current day

func (*Time) BeginOfHour added in v1.0.0

func (t *Time) BeginOfHour() *Time

BeginOfHour return begin time of current hour

func (*Time) BeginOfMinute added in v1.0.0

func (t *Time) BeginOfMinute() *Time

BeginOfMinute return begin second of current minute

func (*Time) BeginOfMonth added in v1.0.0

func (t *Time) BeginOfMonth() *Time

BeginOfMonth return begin day time of current month

func (*Time) BeginOfWeek added in v1.0.0

func (t *Time) BeginOfWeek() *Time

BeginOfWeek return begin day time of current week NOTE: week begin from Sunday

func (*Time) BeginOfYear added in v1.0.0

func (t *Time) BeginOfYear() *Time

BeginOfYear return the beginning time of current year

func (*Time) CurrentMilliTime added in v1.0.0

func (t *Time) CurrentMilliTime() int64

GetCurrentMilliTime return current milliseconds

func (*Time) CurrentNanoTime added in v1.0.0

func (t *Time) CurrentNanoTime() int64

GetCurrentNanoTime return current nano seconds

func (*Time) CurrentUnixTime added in v1.0.0

func (t *Time) CurrentUnixTime() int64

GetCurrentUnixTime return current unix seconds

func (*Time) EndOfDay added in v1.0.0

func (t *Time) EndOfDay() *Time

EndOfDay return end time of current day

func (*Time) EndOfHour added in v1.0.0

func (t *Time) EndOfHour() *Time

EndOfHour return end time of current hour

func (*Time) EndOfMinute added in v1.0.0

func (t *Time) EndOfMinute() *Time

EndOfMinute return end second of current minute

func (*Time) EndOfMonth added in v1.0.0

func (t *Time) EndOfMonth() *Time

EndOfMonth return end day time of current month

func (*Time) EndOfWeek added in v1.0.0

func (t *Time) EndOfWeek() *Time

EndOfWeek return end day time of current week NOTE: week end with Saturday

func (*Time) EndOfYear added in v1.0.0

func (t *Time) EndOfYear() *Time

EndOfYear return the end time of current year

func (*Time) Format added in v1.0.0

func (t *Time) Format(layout string) string

Format returns a textual representation of the time value formatted according to layout

func (*Time) Leap added in v1.0.0

func (t *Time) Leap() bool

Leap check current time is leap year or not

Jump to

Keyboard shortcuts

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