dates

package
v1.0.0-sql.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const ErrorYear string = "0000"
View Source
const Format string = time.RFC3339
View Source
const FormatY string = "2006"
View Source
const FormatYM string = "2006-01"
View Source
const FormatYMD string = "2006-01-02"

Variables

View Source
var ErrorTime time.Time = time.Date(0, 0, 0, 0, 0, 0, 0, time.UTC)

Functions

func GetFormat

func GetFormat(value string) string

GetFormat will return the format to use for the date string passed, using time.RFC3339 as base.

Passing 2024 would return 2006, passing 2024-12-01 would return 2006-01-02 and so on

func MustTime

func MustTime(t time.Time, e error) time.Time

func Range

func Range(start time.Time, end time.Time, interval Interval) []time.Time

func ResetDay

func ResetDay(d time.Time) time.Time

func ResetMonth

func ResetMonth(d time.Time) time.Time

func Time

func Time(s string) time.Time

func ToTime

func ToTime(s string) (t time.Time, err error)

Types

type Interval

type Interval string
const (
	DAY   Interval = "DAY"
	MONTH Interval = "MONTH"
)

Jump to

Keyboard shortcuts

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