Documentation
¶
Index ¶
- Constants
- type Date
- func DateFromOrdinalDate(year, dayOfYear int) (Date, error)
- func DateFromTime(t time.Time) Date
- func MustDateFromOrdinalDate(year, dayOfYear int) Date
- func MustNewDate(year, month, day int) Date
- func NewDate(year, month, day int) (Date, error)
- func ParseDate(layout, value string) (Date, error)
- func Today(location *time.Location) Date
- func (d Date) Add(years, months, days int) Date
- func (d Date) AddDays(days int) Date
- func (d Date) After(dd Date) bool
- func (d Date) Before(dd Date) bool
- func (d Date) Date() (year, month, day int)
- func (d Date) Day() int
- func (d Date) DayOfYear() int
- func (d Date) Equal(dd Date) bool
- func (d Date) Format(layout string) string
- func (d Date) GoString() string
- func (d Date) ISOWeek() (year, week int)
- func (d Date) IsZero() bool
- func (d Date) MarshalJSON() ([]byte, error)
- func (d Date) Month() int
- func (d Date) OrdinalDate() (year, dayOfYear int)
- func (d Date) Quarter() int
- func (d *Date) Scan(value interface{}) (err error)
- func (d Date) String() string
- func (d Date) Sub(dd Date) int
- func (d Date) Time(location *time.Location) time.Time
- func (d *Date) UnmarshalJSON(data []byte) error
- func (d Date) Value() (driver.Value, error)
- func (d Date) Weekday() time.Weekday
- func (d Date) Year() int
- type NullDate
- type ParseError
Constants ¶
const (
RFC3339 = "YYYY-MM-DD"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Date ¶
type Date struct {
// contains filtered or unexported fields
}
Date represents a date.
The zero value of type Date is January 1 of year 1.
swagger:strfmt date
func DateFromOrdinalDate ¶
DateFromOrdinalDate returns the date corresponding to year, day of year.
func DateFromTime ¶
DateFromTime returns the date specified by t.
func MustDateFromOrdinalDate ¶
MustDateFromOrdinalDate is like DateFromOrdinalDate but panics if the date cannot be created.
func MustNewDate ¶
MustNewDate is like NewDate but panics if the date cannot be created.
func ParseDate ¶
ParseDate parses a formatted string and returns the date it represents.
YY 01 Two-digit year YYYY 2001 Four-digit year M 1-12 Month, beginning at 1 MM 01-12 Month, 2-digits MMM Jan-Dec The abbreviated month name MMMM January-December The full month name D 1-31 Day of month DD 01-31 Day of month, 2-digits
func (Date) Add ¶
Add returns the date corresponding to adding the given number of years, months, and days to d.
func (Date) AddDays ¶
AddDays returns the date corresponding to adding the given number of days to d.
func (Date) Format ¶
Format returns a textual representation of the date.
YY 01 Two-digit year YYYY 2001 Four-digit year M 1-12 Month, beginning at 1 MM 01-12 Month, 2-digits MMM Jan-Dec The abbreviated month name MMMM January-December The full month name D 1-31 Day of month DD 01-31 Day of month, 2-digits
func (Date) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface. The date is a quoted string in RFC 3339 format.
func (Date) OrdinalDate ¶
OrdinalDate returns the ordinal date specified by d.
func (Date) Sub ¶
Sub returns the number of days since the date d to dd. If the result exceeds the integer scope, the maximum (or minimum) integer will be returned.
func (*Date) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface. The date is expected to be a quoted string in RFC 3339 format.
type NullDate ¶
NullDate represents a Date that may be null. NullDate implements the sql.Scanner interface, so it can be used as a scan destination, similar to sql.NullString.
swagger:strfmt date
type ParseError ¶
ParseError describes a problem parsing a date string.
func (*ParseError) Error ¶
func (e *ParseError) Error() string
Error returns the string representation of a ParseError.