clock

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Day = 24 * Hour

Day 1day=24h=86400s

View Source
var FmtCompactDate = "20060102"

FmtCompactDate 格式化紧凑型日期

View Source
var FmtCompactFullDate = "20060102150405"

mtCompactDate 格式化紧凑型日期(全量)

View Source
var FmtDate = "2006-01-02"

FmtDate 格式化日期

View Source
var FmtFullDate = "2006-01-02 15:04:05"

FmtFullDate 格式化时间(全量)相当于YYYY-MM:DD HH:mm:ss

View Source
var Hour = 60 * Minute

Hour 1h=60min=3600s

View Source
var Minute = 60

Minute 1min=60s

View Source
var Month = 30 * Day

Month 1Mon=30Day

View Source
var Week = 7 * Day

Week

View Source
var Year = 365 * Day

Year 一年的所有秒数

Functions

func GetDayLastMillisecond

func GetDayLastMillisecond() int64

GetDayLastMillisecond 获取一天内剩余的时间,毫秒数

func GetDayLastSecond

func GetDayLastSecond() int64

GetDayLastSecond 获取一天内剩余的时间,秒数

func GetNextDay

func GetNextDay() time.Time

GetNextDay 获取明天对应的时间对象

func ParseTime

func ParseTime(str string, fmtStr string) (time.Time, error)

Parse 解析时间字符串

Types

type Clock

type Clock struct {
	// contains filtered or unexported fields
}

Clock 结构体 不同于time的很多属性都是毫秒甚至是纳秒,clock(钟表)的最小单位一般是秒

func MustParse

func MustParse(str string, fmtStr string) *Clock

MustParse 解析时间字符串

func New

func New(date time.Time) *Clock

New 实例化

func Now

func Now() *Clock

Now 实例化

func Parse

func Parse(str string, fmtStr string) (*Clock, error)

Parse

func (*Clock) Fmt

func (c *Clock) Fmt(layout string) string

Fmt 格式化返回时间字符串

func (*Clock) SinceDays

func (c *Clock) SinceDays() float64

SinceDays 获取距离当前时间的天数

func (*Clock) SinceHours

func (c *Clock) SinceHours() float64

SinceHours 获取距离当前时间的小时数

func (*Clock) SinceMonths

func (c *Clock) SinceMonths() float64

SinceMonths 获取距离当前时间的月数

func (*Clock) Val

func (c *Clock) Val() int64

Val 获取时间戳

Jump to

Keyboard shortcuts

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