Documentation
¶
Overview ¶
Package date implements types a time-zone-independent representation of time.
Use time.Time for that purpose if location information is required.
Index ¶
- Constants
- type Date
- func (d Date) Add(n int) Date
- func (d Date) After(d2 Date) bool
- func (d Date) Before(d2 Date) bool
- func (d Date) Compare(d2 Date) int
- func (d Date) In(loc *time.Location) time.Time
- func (d Date) IsValid() bool
- func (d Date) IsZero() bool
- func (d Date) MarshalText() ([]byte, error)
- func (d *Date) Scan(v any) (err error)
- func (d Date) Since(s Date) (days int)
- func (d Date) String() string
- func (d *Date) UnmarshalText(p []byte) (err error)
- func (d Date) Value() (driver.Value, error)
- type Month
Constants ¶
View Source
const ISO8601 = "2006-01-02"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Date ¶
A Date represents a date (year, month, day).
func (Date) Add ¶
Add returns the Date that is n days in the future. n can also be negative to go into the past.
func (Date) Compare ¶
Compare compares two Date instances. If d is before d2, it returns -1; if d is after d2, it returns +1; if they're the same, it returns 0.
func (Date) In ¶
In returns the time.Time corresponding to time 00:00:00 of the Date in the location.
func (Date) MarshalText ¶
func (Date) Since ¶
Since returns the signed number of days between the date and s, not including the end day. This is the inverse operation to [Time.Add].
func (*Date) UnmarshalText ¶
Click to show internal directories.
Click to hide internal directories.