ztime

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Nanosecond  Duration = Duration(time.Nanosecond)
	Microsecond          = Duration(time.Microsecond)
	Millisecond          = Duration(time.Millisecond)
	Second               = Duration(time.Second)
	Minute               = Duration(time.Minute)
	Hour                 = Duration(time.Hour)
	Day                  = Duration(time.Hour) * 24
	Week                 = Day * 7
	Month                = Day * 31
	Year                 = Day * 365
	Decade               = Year * 10
	Century              = Decade * 10
)

Variables

This section is empty.

Functions

func IsWeekday

func IsWeekday(date time.Time) bool

Returns true if the given date falls on a weekday

func IsWeekend

func IsWeekend(date time.Time) bool

Returns true if the given date falls on a weekend

Types

type Duration added in v0.7.10

type Duration time.Duration

func ParseDuration added in v0.7.9

func ParseDuration(s string) (Duration, error)

Extend version of ParseDuration. Source code is almost identical to Supports day (d) and week (w) units as well as general month (M) and year (Y) durations. Month is defined as 31 days and a year is 365 days.

func (Duration) String added in v0.7.10

func (d Duration) String() string

func (*Duration) UnmarshalJSON added in v0.7.10

func (d *Duration) UnmarshalJSON(val []byte) (err error)

func (*Duration) UnmarshalYAML added in v0.7.10

func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) (err error)

type ParseError added in v0.7.9

type ParseError struct {
	Layout     string
	Value      string
	LayoutElem string
	ValueElem  string
	Message    string
}

ParseError describes a problem parsing a time string.

Jump to

Keyboard shortcuts

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