date: Index | Files | Directories

package date

import ""


Package Files

date.go dateGopherJS.go


const (
    Min = -1 << 31
    Max = 1<<31 - 1


type Date Uses

type Date int32

Date represents a date with a resolution of one day.

func First Uses

func First(d Date, ds ...Date) Date

First returns the earliest provided date

func Last Uses

func Last(d Date, ds ...Date) Date

Last returns the latest provided date

func NewDate Uses

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

NewDate returns a Date in the specified location If the location is not specified UTC is assumed

func NewDateFromJSObject Uses

func NewDateFromJSObject(jsDate *js.Object) Date

NewDateFromJSObject returns the date encoded in a JavaScript object. Supported argument types are string (YYYY-MM-DD), Date or any object with a toISOString() method (e.g. Moment from Moments.js).

func ParseDate Uses

func ParseDate(layout, value string) (Date, error)

ParseDate parses a formatted string and returns the value it represents. The layout defines the format by showing how the reference date

Mon Jan 2 2006

woud be represented. See the documentation of time.ParseInLocation for more in depth documentation.

func Today Uses

func Today() Date

Today returns the current date in your local timezone (see time.Now() for details).

func (Date) Add Uses

func (d Date) Add(year, month, day int) Date

Add returns a modified date. It follows the same rules as t.AddDate().

func (Date) Day Uses

func (d Date) Day() int

Day returns the day of the month [1:31]

func (Date) Format Uses

func (d Date) Format(layout string) string

Format returns a textual representation of the time value formatted according to layout, which defines the format by showing how the reference time, defined to be

Mon Jan 2 15:04:05 -0700 MST 2006

would be displayed if it were the value; it serves as an example of the desired output. See time.Time.Format for details.

func (Date) ISOWeek Uses

func (d Date) ISOWeek() (year, week int)

ISOWeek returns the ISO 8601 year and week number in which the date 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 (Date) Month Uses

func (d Date) Month() time.Month

Month returns the month of the year [1,12]

func (Date) PreviousWeekday Uses

func (d Date) PreviousWeekday(day time.Weekday) Date

PreviousWeekday returns the clostest previous date which is at the specified weekday.

func (Date) String Uses

func (d Date) String() string

String returns a human readable string

func (Date) Time Uses

func (d Date) Time(hour, minute, second, nanosecond int, loc *time.Location) time.Time

Time returns the time at the date at the specified time of day

func (Date) Weekday Uses

func (d Date) Weekday() time.Weekday

Weekday returns the weekday of the date

func (Date) Year Uses

func (d Date) Year() int

Year returns the year



Package date imports 3 packages (graph) and is imported by 1 packages. Updated 2019-09-11. Refresh now. Tools for package owners.