Documentation ¶
Index ¶
- type TinyDate
- func Earliest(left, right TinyDate) TinyDate
- func FromString(value string) TinyDate
- func FromTime(t time.Time) (TinyDate, error)
- func Latest(left, right TinyDate) TinyDate
- func MustNew(year, month, day int) TinyDate
- func MustParse(layout, value string) TinyDate
- func New(year, month, day int) (TinyDate, error)
- func Now() TinyDate
- func Parse(layout, value string) (TinyDate, error)
- func ParseInLocation(layout, value string, loc *time.Location) (TinyDate, error)
- func Unix(sec int64, nsec int64) TinyDate
- func (td TinyDate) Add(d time.Duration) TinyDate
- func (td TinyDate) AddDate(years int, months int, days int) TinyDate
- func (td TinyDate) After(tu TinyDate) bool
- func (td TinyDate) AppendFormat(b []byte, layout string) []byte
- func (td TinyDate) Before(tu TinyDate) bool
- func (td TinyDate) Date() (year int, month time.Month, day int)
- func (td TinyDate) Day() int
- func (td TinyDate) Equal(tu TinyDate) bool
- func (td TinyDate) Format(layout string) string
- func (td *TinyDate) GobDecode(data []byte) error
- func (td TinyDate) GobEncode() ([]byte, error)
- func (td TinyDate) ISOWeek() (year, week int)
- func (td TinyDate) IsZero() bool
- func (td TinyDate) MarshalBinary() ([]byte, error)
- func (td TinyDate) MarshalJSON() ([]byte, error)
- func (td TinyDate) MarshalText() ([]byte, error)
- func (td TinyDate) Month() time.Month
- func (td *TinyDate) Scan(value interface{}) error
- func (td TinyDate) String() string
- func (td TinyDate) Sub(tu TinyDate) time.Duration
- func (td TinyDate) ToTime() time.Time
- func (td TinyDate) Unix() int64
- func (td TinyDate) UnixNano() int64
- func (td *TinyDate) UnmarshalBinary(data []byte) error
- func (td *TinyDate) UnmarshalJSON(data []byte) error
- func (td *TinyDate) UnmarshalText(data []byte) error
- func (td TinyDate) Value() (driver.Value, error)
- func (td TinyDate) Weekday() time.Weekday
- func (td TinyDate) Year() int
- func (td TinyDate) YearDay() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TinyDate ¶
type TinyDate struct {
// contains filtered or unexported fields
}
TinyDate -
func FromString ¶
FromString is shortcut for MustParse("2006-01-02", value)
func FromTime ¶
FromTime converts a time.Time into a TinyDate all tinyTinyDate.TinyDates are UTC timezone, so that conversion will be made here
func MustNew ¶
MustNew creates a new TinyDate just like New, but panics when error occurs (and of course returns only TinyDate so that it can be inlined) it will panic when too big year is specified, however we just don't care
func New ¶
New creates a new TinyDate, similar to the time.Time package, months are specifed from 1-12, and days are specified 1-31, depending on the month
func ParseInLocation ¶
ParseInLocation parses a layout into a TinyDate including a location. The input is converted into UTC
func Unix ¶
Unix creates a tinydate from seconds and nanoseconds. As usual, this is truncated to the nearest day
func (TinyDate) Add ¶
Add a duration to a TinyDate. Will only have an effect if more than 1 day is added
func (TinyDate) AddDate ¶
AddDate returns the time corresponding to adding the given number of years, months, and days to t. For example, AddDate(-1, 2, 3) applied to January 1, 2011 returns March 4, 2010.
func (TinyDate) AppendFormat ¶
AppendFormat is like Format but appends the textual representation to b and returns the extended buffer
func (TinyDate) Format ¶
Format returns a formatted date, as specified by the standard time library https://golang.org/src/time/format.go?s=16029:16071#L485
func (TinyDate) ISOWeek ¶
ISOWeek returns the ISO 8601 year and week number in which t occurs. Week ranges from 1 to 53. Jan 01 to Jan 03 of year n might belong to week 52 or 53 of year n-1, and Dec 29 to Dec 31 might belong to week 1 of year n+1.
func (TinyDate) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface
func (TinyDate) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface
func (TinyDate) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface. The time is formatted in RFC 3339 format, with sub-second precision added if present.
func (TinyDate) Unix ¶
Unix returns the date as a Unix timestamp where the precision is only to the day. Hours, minutes, and seconds are just padded zeros
func (TinyDate) UnixNano ¶
UnixNano returns the date as a Unix timestamp in nanoseconds where the precision is only to the day. Hours, minutes, seconds and nanoseconds are just padded zeros
func (*TinyDate) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface
func (*TinyDate) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*TinyDate) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface. The time is expected to be in RFC 3339 format.