datetime

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimeFormatYMDhms = "2006-01-02 15:04:05" //default format
	TimeFormatYMD    = "2006-01-02"          //default format
)

Variables

This section is empty.

Functions

func DayStartTime

func DayStartTime(t time.Time) time.Time

func EmptyTimeToNow

func EmptyTimeToNow(t time.Time) time.Time

func FormatAsDate added in v0.6.2

func FormatAsDate(t time.Time) string

func FormatYDMHMS added in v0.7.0

func FormatYDMHMS(in time.Time) string

func LastDay added in v0.7.0

func LastDay(d time.Time) time.Time

func NextDay added in v0.7.0

func NextDay(d time.Time) time.Time

func NowStrYMDHMS added in v0.7.0

func NowStrYMDHMS() string

func SplitStr2DateRange added in v0.8.1

func SplitStr2DateRange(utime, separator string) (start string, end string, err error)

func Time2Pointer added in v0.6.6

func Time2Pointer(input time.Time) *time.Time

time.Time to *time.Time https://github.com/golang/go/issues/45653#issuecomment-823821601

func TimeFormat

func TimeFormat(tm time.Time, format string) (res string)

func TimeFormatByYMDHMS

func TimeFormatByYMDHMS(format string) (res string)

func Timestamp2TimeInt64

func Timestamp2TimeInt64(in int64) time.Time

func Timestamp2TimeUint64

func Timestamp2TimeUint64(in uint64) time.Time

func TodayStartTime added in v0.6.7

func TodayStartTime() time.Time

func TomorrowStartTime added in v0.7.0

func TomorrowStartTime() time.Time

func YesterdayStartTime added in v0.7.0

func YesterdayStartTime() time.Time

Types

type DateTimeRange added in v0.8.1

type DateTimeRange struct {
	Start          time.Time
	End            time.Time
	TimestampStart uint64
	TimestampEnd   uint64
	DateTimeString string
	DateString     string
}

func DayRange added in v0.7.0

func DayRange(d time.Time) (dateSE DateTimeRange)

func GetTodayRange

func GetTodayRange() DateTimeRange

func GetYesterdayRange

func GetYesterdayRange() DateTimeRange

func LastDayRange added in v0.7.0

func LastDayRange(d time.Time) DateTimeRange

func NextDayRange added in v0.7.0

func NextDayRange(d time.Time) DateTimeRange

type JsonTime added in v0.8.1

type JsonTime struct {
	time.Time
	FormatStr string //if not set,use default,or custom
}

func (JsonTime) GetFormatStr added in v0.8.1

func (j JsonTime) GetFormatStr() string

func (JsonTime) MarshalJson added in v0.8.1

func (j JsonTime) MarshalJson() ([]byte, error)

func (JsonTime) String added in v0.8.1

func (j JsonTime) String() string

func (*JsonTime) UnmarshalJson added in v0.8.1

func (j *JsonTime) UnmarshalJson(data []byte) (err error)

type SortableTimeArray added in v0.8.1

type SortableTimeArray []time.Time

Sortable time array

func (SortableTimeArray) Len added in v0.8.1

func (s SortableTimeArray) Len() int

func (SortableTimeArray) Less added in v0.8.1

func (s SortableTimeArray) Less(i, j int) bool

func (SortableTimeArray) Swap added in v0.8.1

func (s SortableTimeArray) Swap(i, j int)

Jump to

Keyboard shortcuts

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