timex

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatMonthlyOccurrence added in v1.1.0

func FormatMonthlyOccurrence(t time.Time) string

FormatMonthlyOccurrence extracts the day and week number from a timestamp and formats it into a human-readable string for when in the month that it occurs.

eg, "first Monday" or "last Saturday"

func MidPoint added in v1.4.0

func MidPoint(t1, t2 time.Time) (time.Time, error)

MidPoint calculates the mid-point between two timestamps

func NextMonth added in v1.1.0

func NextMonth(t time.Time) time.Time

NextMonth calculates the timestamp of the next occurrence in the following month from the given timestamp.

func NextWeekday

func NextWeekday(t time.Time, weekday string, hour int) time.Time

NextWeekday calculates the timestamp of the next occurring weekday from the given timestamp.

func ParseWeekday

func ParseWeekday(s string) (time.Weekday, error)

ParseWeekday parses a weekday given by its name. Both long names such as "Monday", "Tuesday", etc. and short names such as "Mon", "Tue" are supported. Case is ignored.

Types

This section is empty.

Jump to

Keyboard shortcuts

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