date

package module
v0.0.0-...-a32ebd0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2017 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Min = -1 << 31
	Max = 1<<31 - 1
)

Limits

Variables

This section is empty.

Functions

This section is empty.

Types

type Date

type Date int32

Date represents a date with a resolution of one day.

func First

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

First returns the earliest provided date

func Last

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

Last returns the latest provided date

func NewDate

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 ParseDate

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

func Today() Date

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

func (Date) Add

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

func (d Date) Day() int

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

func (Date) ISOWeek

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

func (d Date) Month() time.Month

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

func (Date) PreviousWeekday

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

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

func (Date) String

func (d Date) String() string

String returns a human readable string

func (Date) Time

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

func (d Date) Weekday() time.Weekday

Weekday returns the weekday of the date

func (Date) Year

func (d Date) Year() int

Year returns the year

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL