extime

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Date

func Date(t time.Time, layout string) string

Date 跟 PHP 中 date 类似的使用方式 layout 格式,如"Y-m-d H:i:s".

func Days

func Days(d time.Duration) float64

Days time.Duration转化为天数

func EndOfDay

func EndOfDay(t time.Time) time.Time

EndOfDay 获取日期中当天的结束时间.

func EndOfMonth

func EndOfMonth(t time.Time) time.Time

EndOfMonth 获取日期中当月的结束时间.

func EndOfWeek

func EndOfWeek(date time.Time, weekStartDay ...time.Weekday) time.Time

EndOfWeek 获取日期中当周的结束时间; weekStartDay 周几作为周的第一天,本库默认周一.

func EndOfYear

func EndOfYear(t time.Time) time.Time

EndOfYear 获取日期中当年的结束时间.

func IsLeapYear

func IsLeapYear(year int) bool

IsLeapYear 是否闰年

func MSleep

func MSleep(t int64)

MSleep pauses the current goroutine for at least the millisecond d. A negative or zero duration causes Sleep to return immediately.

func Microsecond

func Microsecond(t time.Time) int64

Microsecond time.Time 转为 微秒

func Millisecond

func Millisecond(t time.Time) int64

Millisecond time.Time 转为 毫秒

func MonthDays

func MonthDays(year int, month time.Month) int

MonthDays 所在年份月份的天数

func MonthDays2

func MonthDays2(t time.Time) int

MonthDays2 t 所在时间月份的天数

func Now

func Now(layout string) string

Now 跟 PHP 中 date 类似的使用方式 layout 格式,如"Y-m-d H:i:s".

func NowMS

func NowMS() int64

NowMS time.Now() 转为 毫秒

func NowUS

func NowUS() int64

NowUS time.Now() 转为 微秒

func Parse

func Parse(value string) time.Time

Parse parse value use PHP time format.

func ParseLocation

func ParseLocation(value string) time.Time

ParseLocation parse location

func ServiceElapseTime

func ServiceElapseTime() time.Duration

ServiceElapseTime 服务启动了多少时间

func ServiceStartupTime

func ServiceStartupTime() time.Time

ServiceStartupTime 服务启动时间

func ServiceUptime

func ServiceUptime() int64

ServiceUptime 服务启动了多少second

func Sleep

func Sleep(t int64)

Sleep pauses the current goroutine for at least the second d. A negative or zero duration causes Sleep to return immediately.

func StartOfDay

func StartOfDay(t time.Time) time.Time

StartOfDay 获取日期中当天的开始时间.

func StartOfMonth

func StartOfMonth(t time.Time) time.Time

StartOfMonth 获取日期中当月的开始时间.

func StartOfWeek

func StartOfWeek(date time.Time, weekStartDay ...time.Weekday) time.Time

StartOfWeek 获取日期中当周的开始时间; weekStartDay 周几作为周的第一天,本库默认周一.

func StartOfYear

func StartOfYear(t time.Time) time.Time

StartOfYear 获取日期中当年的开始时间.

func Time

func Time(msec int64) time.Time

Time 毫秒转time.Time

func USleep

func USleep(t int64)

USleep pauses the current goroutine for at least the microsecond d. A negative or zero duration causes Sleep to return immediately.

func Valid

func Valid(year, month, day int) bool

Valid 检查是否正常的日期.

func YearDays

func YearDays(year int) int

YearDays 所在年份总天数

Types

This section is empty.

Jump to

Keyboard shortcuts

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