time

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TimeFormats = []string{"1/2/2006", "1/2/2006 15:4:5", "2006", "2006-1", "2006-1-2", "2006-1-2 15", "2006-1-2 15:4", "2006-1-2 15:4:5", "1-2", "15:4:5", "15:4", "15", "15:4:5 Jan 2, 2006 MST", "2006-01-02 15:04:05.999999999 -0700 MST", "2006-01-02T15:04:05-07:00"}

TimeFormats default time formats will be parsed as

View Source
var WeekStartDay = time.Monday

WeekStartDay set week start day, default is Monday

Functions

func BeginningOfDay

func BeginningOfDay(now time.Time) time.Time

BeginningOfDay beginning of day

func BeginningOfHour

func BeginningOfHour(now time.Time) time.Time

BeginningOfHour beginning of hour

func BeginningOfMinute

func BeginningOfMinute(now time.Time) time.Time

BeginningOfMinute beginning of minute

func BeginningOfMonth

func BeginningOfMonth(now time.Time) time.Time

BeginningOfMonth beginning of month

func BeginningOfQuarter

func BeginningOfQuarter(now time.Time) time.Time

BeginningOfQuarter beginning of quarter

func BeginningOfWeek

func BeginningOfWeek(now time.Time) time.Time

BeginningOfWeek beginning of week

func BeginningOfYear

func BeginningOfYear(now time.Time) time.Time

BeginningOfYear BeginningOfYear beginning of year

func Between

func Between(now time.Time, begin, end string) bool

Between check time between the begin, end time or not

func EndOfDay

func EndOfDay(now time.Time) time.Time

EndOfDay end of day

func EndOfHour

func EndOfHour(now time.Time) time.Time

EndOfHour end of hour

func EndOfMinute

func EndOfMinute(now time.Time) time.Time

EndOfMinute end of minute

func EndOfMonth

func EndOfMonth(now time.Time) time.Time

EndOfMonth end of month

func EndOfQuarter

func EndOfQuarter(now time.Time) time.Time

EndOfQuarter end of quarter

func EndOfSunday

func EndOfSunday(now time.Time) time.Time

EndOfSunday end of sunday

func EndOfWeek

func EndOfWeek(now time.Time) time.Time

EndOfWeek end of week

func EndOfYear

func EndOfYear(now time.Time) time.Time

EndOfYear end of year

func Monday

func Monday(now time.Time) time.Time

Monday monday

func MustParse

func MustParse(now time.Time, strs ...string) (t time.Time)

MustParse must parse string to time or it will panic

func Parse

func Parse(now time.Time, strs ...string) (t time.Time, err error)

Parse parse string to time

func Sunday

func Sunday(now time.Time) time.Time

Sunday sunday

Types

This section is empty.

Jump to

Keyboard shortcuts

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