dates

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NowFunc = time.Now

Functions

func EndOfDay

func EndOfDay(t time.Time) time.Time

func EndOfYear

func EndOfYear(t time.Time) time.Time

func ToTime

func ToTime(duration string, location *time.Location) (time.Time, error)

ToTime parses an offset duration string. The calculation is based on an optional anchor (default is NOW) plus a duration. Valid Anchors:

EOD will calculate the end of day
EOY will calculate end of year

A duration string is a number and unit suffix, such as "300m", "1.5h" or "2h45m". Valid time units are "m", "h". If location is provided, calculations are set to the corresponding time zone. Examples:

"EOD+72h" = end of day in 3 days
"3h" = 3 hours
"EOY" = end of year
"30m" = 30 minutes
"" = now

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳