Documentation
¶
Index ¶
- type TinyTime
- func (tt TinyTime) Add(d time.Duration) TinyTime
- func (tt TinyTime) AddDate(years int, months int, days int) TinyTime
- func (tt TinyTime) After(tu TinyTime) bool
- func (tt TinyTime) AppendFormat(b []byte, layout string) []byte
- func (tt TinyTime) Before(tu TinyTime) bool
- func (tt TinyTime) Clock() (hour, min, sec int)
- func (tt TinyTime) Date() (year int, month time.Month, day int)
- func (tt TinyTime) Day() int
- func (tt TinyTime) Equal(tu TinyTime) bool
- func (tt TinyTime) Format(layout string) string
- func (tt *TinyTime) GobDecode(data []byte) error
- func (tt TinyTime) GobEncode() ([]byte, error)
- func (tt TinyTime) Hour() int
- func (tt TinyTime) ISOWeek() (year, week int)
- func (tt TinyTime) IsZero() bool
- func (tt TinyTime) MarshalBinary() ([]byte, error)
- func (tt TinyTime) MarshalJSON() ([]byte, error)
- func (tt TinyTime) MarshalText() ([]byte, error)
- func (tt TinyTime) Minute() int
- func (tt TinyTime) Month() time.Month
- func (tt TinyTime) Round(d time.Duration) time.Time
- func (tt TinyTime) Second() int
- func (tt TinyTime) String() string
- func (tt TinyTime) Sub(tu TinyTime) time.Duration
- func (tt TinyTime) ToTime() time.Time
- func (tt TinyTime) Truncate(d time.Duration) time.Time
- func (tt TinyTime) Unix() int64
- func (tt TinyTime) UnixNano() int64
- func (tt *TinyTime) UnmarshalBinary(data []byte) error
- func (tt *TinyTime) UnmarshalJSON(data []byte) error
- func (tt *TinyTime) UnmarshalText(data []byte) error
- func (tt TinyTime) Weekday() time.Weekday
- func (tt TinyTime) Year() int
- func (tt TinyTime) YearDay() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TinyTime ¶
type TinyTime struct {
// contains filtered or unexported fields
}
TinyTime -
func FromTime ¶
FromTime converts a time.Time into a TinyTime all tinyTinyTime.TinyTimes are UTC timezone, so that conversion will be made here
func New ¶
New creates a new TinyTime, 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 TinyTime including a location. The input is converted into UTC
func Unix ¶
Unix creates a tinytime from seconds and nanoseconds. As usual, this is truncated to the nearest day
func (TinyTime) Add ¶
Add a duration to a TinyTime. Will only have an effect if more than 1 day is added
func (TinyTime) 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 (TinyTime) AppendFormat ¶
AppendFormat is like Format but appends the textual representation to b and returns the extended buffer
func (TinyTime) Format ¶
Format returns a formatted time, as specified by the standard time library https://golang.org/src/time/format.go?s=16029:16071#L485
func (TinyTime) 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 (TinyTime) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface
func (TinyTime) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface
func (TinyTime) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface. The time is formatted in RFC 3339 format, with sub-second precision added if present.
func (TinyTime) Minute ¶
Minute returns the minute offset within the hour specified by tt, in the range [0, 59]
func (TinyTime) Round ¶
Round returns the result of rounding t to the nearest multiple of d (since the zero time). The rounding behavior for halfway values is to round up. If d <= 0, Round returns t stripped of any monotonic clock reading but otherwise unchanged.
Round operates on the time as an absolute duration since the zero time; it does not operate on the presentation form of the time. Thus, Round(Hour) may return a time with a non-zero minute, depending on the time's Location.
func (TinyTime) Second ¶
Second returns the second offset within the minute specified by tt, in the range [0, 59]
func (TinyTime) Truncate ¶
Truncate returns the result of rounding t down to a multiple of d (since the zero time). If d <= 0, Truncate returns t stripped of any monotonic clock reading but otherwise unchanged.
Truncate operates on the time as an absolute duration since the zero time; it does not operate on the presentation form of the time. Thus, Truncate(Hour) may return a time with a non-zero minute, depending on the time's Location.
func (TinyTime) Unix ¶
Unix returns the time as a Unix timestamp where the precision is only to the day. Hours, minutes, and seconds are just padded zeros
func (TinyTime) UnixNano ¶
UnixNano returns the time as a Unix timestamp in nanoseconds where the precision is only to the day. Hours, minutes, seconds and nanoseconds are just padded zeros
func (*TinyTime) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface
func (*TinyTime) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*TinyTime) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface. The time is expected to be in RFC 3339 format.