date

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RFC1123_1  = "Mon, _2 Jan 2006 15:04:05 MST"
	RFC1123_2  = "Mon, 2 Jan 2006 15:04:05 MST"
	RFC1123Z_1 = "Mon, _2 Jan 2006 15:04:05 -0700"
	RFC1123Z_2 = "Mon, 2 Jan 2006 15:04:05 -0700"
)
View Source
const (
	Simple12 = "Jan 02 03:04 PM"
	Simple24 = "Jan 02 15:04"
)

Variables

This section is empty.

Functions

func EndOfDay

func EndOfDay(t time.Time) time.Time

func Format

func Format(t time.Time) string

func FormatJson

func FormatJson(t time.Time) string

func Match

func Match(layout, format string) bool

Format the current time with the given layout and return whether or not it matches the provided format.

func MatchTime

func MatchTime(layout, format string, t time.Time) bool

Format the given time with layout and return whether or not it matches the provided format.

func ParseDate

func ParseDate(date string) (t time.Time)

Parse a date string to time in format yyyy-mm-dd, yyyy-mm, yyyy.

func ParseRFC1123

func ParseRFC1123(date string) (t time.Time)

Mon, 02 Jan 2006 15:04:05 MST Tue, 07 Dec 2021 19:57:22 -0500 Fri, 6 Nov 2020 19:32:35 +0000

func StartOfDay

func StartOfDay(t time.Time) time.Time

func YMD

func YMD(t time.Time) string

Types

type DateRange

type DateRange struct {
	// contains filtered or unexported fields
}

func NewDateRange

func NewDateRange(a, b time.Time) *DateRange

func (*DateRange) AfterDate

func (d *DateRange) AfterDate() string

func (*DateRange) BeforeDate

func (d *DateRange) BeforeDate() string

func (*DateRange) IsZero

func (d *DateRange) IsZero() bool

Jump to

Keyboard shortcuts

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