datetime

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var (
	TimeFormatStrYMDHMS = TimeFormatByYMDHMS("yyyy-MM-dd hh:mm:ss")
	TimeFormatStrYMD    = TimeFormatByYMDHMS("yyyy-MM-dd")
)

Functions

func DayStartTime

func DayStartTime(t time.Time) time.Time

func EmptyTimeToNow

func EmptyTimeToNow(t time.Time) time.Time

如果传进的时间为0,则返回当前时间

func GetLastDay added in v0.2.11

func GetLastDay(d time.Time) time.Time

func GetNextDay added in v0.2.11

func GetNextDay(d time.Time) time.Time

func SplitTimeRangeStr added in v0.5.5

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

utime 时间字符串 separator 分隔符

func TimeFormat

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

func TimeFormatByYMDHMS added in v0.2.2

func TimeFormatByYMDHMS(format string) (res string)

func Timestamp2TimeInt64

func Timestamp2TimeInt64(in int64) time.Time

func Timestamp2TimeUint64

func Timestamp2TimeUint64(in uint64) time.Time

Types

type JSONTIME

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

func (JSONTIME) GetFormatStr added in v0.5.5

func (j JSONTIME) GetFormatStr() string

func (JSONTIME) MarshalJSON

func (j JSONTIME) MarshalJSON() ([]byte, error)

func (JSONTIME) String

func (j JSONTIME) String() string

func (*JSONTIME) UnmarshalJSON

func (j *JSONTIME) UnmarshalJSON(data []byte) (err error)

type STDateStartEnd

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

func GetDayRange

func GetDayRange(d time.Time) (dateSE STDateStartEnd)

func GetLastDayRange

func GetLastDayRange(d time.Time) (dateSE STDateStartEnd)

func GetNextDayRange

func GetNextDayRange(d time.Time) (dateSE STDateStartEnd)

func GetTodayRange

func GetTodayRange() (dateSE STDateStartEnd)

func GetYesterdayRange

func GetYesterdayRange() (dateSE STDateStartEnd)

type TimeArray

type TimeArray []time.Time

可排序的时间数组

func (TimeArray) Len

func (s TimeArray) Len() int

func (TimeArray) Less

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

func (TimeArray) Swap

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

Jump to

Keyboard shortcuts

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