go-tinydate: github.com/lane-c-wagner/go-tinydate Index | Files | Directories

package tinydate

import "github.com/lane-c-wagner/go-tinydate"

Index

Package Files

binary.go convert.go create.go format.go getters.go gob_encode.go json.go operators.go text.go tinydate.go

type TinyDate Uses

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

TinyDate -

func FromTime Uses

func FromTime(t time.Time) (TinyDate, error)

FromTime converts a time.Time into a TinyDate all tinyTinyDate.TinyDates are UTC timezone, so that conversion will be made here

func New Uses

func New(year, month, day int) (TinyDate, error)

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 Now Uses

func Now() TinyDate

Now returns the current date

func Parse Uses

func Parse(layout, value string) (TinyDate, error)

Parse a layout into a TinyDate, truncating any non-date information

func ParseInLocation Uses

func ParseInLocation(layout, value string, loc *time.Location) (TinyDate, error)

ParseInLocation parses a layout into a TinyDate including a location. The input is converted into UTC

func Unix Uses

func Unix(sec int64, nsec int64) TinyDate

Unix creates a tinydate from seconds and nanoseconds. As usual, this is truncated to the nearest day

func (TinyDate) Add Uses

func (td TinyDate) Add(d time.Duration) TinyDate

Add a duration to a TinyDate. Will only have an effect if more than 1 day is added

func (TinyDate) AddDate Uses

func (td TinyDate) AddDate(years int, months int, days int) TinyDate

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) After Uses

func (td TinyDate) After(tu TinyDate) bool

After returns true if td is after tu

func (TinyDate) AppendFormat Uses

func (td TinyDate) AppendFormat(b []byte, layout string) []byte

AppendFormat is like Format but appends the textual representation to b and returns the extended buffer

func (TinyDate) Before Uses

func (td TinyDate) Before(tu TinyDate) bool

Before returns true if td is before tu

func (TinyDate) Date Uses

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

Date returns the readable numerical values of the date

func (TinyDate) Day Uses

func (td TinyDate) Day() int

Day retruns the day of the month as an integer

func (TinyDate) Equal Uses

func (td TinyDate) Equal(tu TinyDate) bool

Equal returns true if the dates are exactly the same

func (TinyDate) Format Uses

func (td TinyDate) Format(layout string) string

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) GobDecode Uses

func (td *TinyDate) GobDecode(data []byte) error

GobDecode implements the gob.GobDecoder interface

func (TinyDate) GobEncode Uses

func (td TinyDate) GobEncode() ([]byte, error)

GobEncode implements the gob.GobEncoder interface

func (TinyDate) ISOWeek Uses

func (td TinyDate) ISOWeek() (year, week int)

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) IsZero Uses

func (td TinyDate) IsZero() bool

IsZero returns true if the date represents the first day, January 01, 0000

func (TinyDate) MarshalBinary Uses

func (td TinyDate) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface

func (TinyDate) MarshalJSON Uses

func (td TinyDate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (TinyDate) MarshalText Uses

func (td TinyDate) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface. The time is formatted in RFC 3339 format, with sub-second precision added if present.

func (TinyDate) Month Uses

func (td TinyDate) Month() time.Month

Month returns the month of the date 1-12

func (TinyDate) String Uses

func (td TinyDate) String() string

String returns the month formatted as a readable string

func (TinyDate) Sub Uses

func (td TinyDate) Sub(tu TinyDate) time.Duration

Sub returns the duration (in days) between td and tu

func (TinyDate) ToTime Uses

func (td TinyDate) ToTime() time.Time

ToTime converts a tinyTinyDate.TinyDate to a time.Time, always UTC

func (TinyDate) Unix Uses

func (td TinyDate) Unix() int64

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 Uses

func (td TinyDate) UnixNano() int64

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 Uses

func (td *TinyDate) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface

func (*TinyDate) UnmarshalJSON Uses

func (td *TinyDate) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*TinyDate) UnmarshalText Uses

func (td *TinyDate) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface. The time is expected to be in RFC 3339 format.

func (TinyDate) Weekday Uses

func (td TinyDate) Weekday() time.Weekday

Weekday returns the day of the week

func (TinyDate) Year Uses

func (td TinyDate) Year() int

Year returns the year as the readable numerical value e.g. 2020

func (TinyDate) YearDay Uses

func (td TinyDate) YearDay() int

YearDay returns the day of the year specified by t, in the range [1,365] for non-leap years, and [1,366] in leap years

Directories

PathSynopsis
example

Package tinydate imports 4 packages (graph) and is imported by 1 packages. Updated 2020-04-01. Refresh now. Tools for package owners.