Documentation
¶
Index ¶
- Constants
- func DayRange(t time.Time, loc *time.Location) (time.Time, time.Time)
- func MonthRange(t time.Time, loc *time.Location) (time.Time, time.Time)
- func PositiveUnix(t time.Time) int64
- func Range(start, end time.Time, step time.Duration) []time.Time
- func RangeN(start time.Time, step time.Duration, n int) []time.Time
- func Unix(t time.Time) int64
- func UnixMicro(t time.Time) int64
- func UnixMilli(t time.Time) int64
- func UnixNano(t time.Time) int64
- type Stopwatch
Constants ¶
View Source
const ( Layout2DateDay = "2006-01-02" Layout2DateHour = "2006-01-02 15" Layout2DateMinute = "2006-01-02 15:04" Layout2DateTime = "2006-01-02 15:04:05" Layout2StampMilli = "2006-01-02 15:04:05.000" Layout2StampMicro = "2006-01-02 15:04:05.000000" Layout2StampNano = "2006-01-02 15:04:05.000000000" )
time layout format 这里只定义 layout 格式,请按需选择即可,格式化输出请使用: t.Format(layout)
Variables ¶
This section is empty.
Functions ¶
func MonthRange ¶
MonthRange 根据传入时间,获取当月的起始时间点
func PositiveUnix ¶
PositiveUnix 获取 time.Time 的时间戳, 若time小于1970-01-01 00:00:00 则返回0
Types ¶
type Stopwatch ¶
type Stopwatch struct {
// contains filtered or unexported fields
}
Stopwatch 用于计算一段代码所运行的时间
func (*Stopwatch) ElapsedTime ¶
ElapsedTime 返回自 Stopwatch 创建以来所经过的时间
Click to show internal directories.
Click to hide internal directories.