date

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const RFC3339Date = `2006-01-02`
View Source
const RFC3339DateJSON = `"` + RFC3339Date + `"`

Variables

View Source
var ErrInvalidDate = errors.New("invalid date")

Functions

This section is empty.

Types

type Date

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

func From

func From(t time.Time) Date

func New

func New(year int, month time.Month, day int) Date

func Parse

func Parse(s string) (Date, bool)

func (Date) Add

func (d Date) Add(duration time.Duration) Date

func (Date) AddDate

func (d Date) AddDate(years int, months int, days int) Date

func (Date) AddDays

func (d Date) AddDays(days int) Date

func (Date) Day

func (d Date) Day() int

func (Date) Format

func (d Date) Format(layout string) string

func (Date) IsZero

func (d Date) IsZero() bool

func (Date) MarshalBSONValue

func (d Date) MarshalBSONValue() (bsontype.Type, []byte, error)

func (Date) MarshalJSON

func (d Date) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. Converts to "yyyy-MMM-dd" format.

func (Date) Month

func (d Date) Month() time.Month

func (Date) Time

func (d Date) Time() time.Time

func (*Date) UnmarshalBSONValue

func (d *Date) UnmarshalBSONValue(t bsontype.Type, data []byte) error

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. Converts from "yyyy-MMM-dd" format.

func (Date) Weekday

func (d Date) Weekday() time.Weekday

func (Date) Year

func (d Date) Year() int

Jump to

Keyboard shortcuts

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