ratadie: bitbucket.org/classroomsystems/ratadie Index | Files

package ratadie

import "bitbucket.org/classroomsystems/ratadie"

Package ratadie represents calendar dates as fixed integers, as specified in Dershowitz and Reingold's Calendrical Calculations.

Index

Package Files

ratadie.go

type Day Uses

type Day int32

A Day represents a given calendar date as a fixed integer, as specified in Dershowitz and Reingold's Calendrical Calculations. Day(1) is Jan 1 of year 1 in the proleptic Gregorian calendar. Representable dates range from Jun 22, -5879610 to Jul 11, 5879611.

func Date Uses

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

Date returns the Day for the given year, month, and day. The result of passing out-of-range month or day values is undefined. Do not use this function for month arithmetic.

func Parse Uses

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

Parse parses a formatted string and returns the day value it represents. It is a convenience wrapper around time.Parse.

Note that time and location may be specified in the format, but are completely ignored.

func Time Uses

func Time(t time.Time) Day

Time is equivalent to calling Date(t.Date()). Note that time and location are completely ignored.

func Today Uses

func Today() Day

Today returns today's date. It is equivalent to Time(time.Now()).

func (Day) Date Uses

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

Date returns the Gregorian year, month, and day for rd.

func (Day) Format Uses

func (rd Day) Format(layout string) string

Format is just a convenience for rd.Time().Format(layout)

func (Day) Time Uses

func (rd Day) Time() time.Time

Time returns a UTC time value for midnight on the day represented by rd.

func (Day) TimeIn Uses

func (rd Day) TimeIn(loc *time.Location) time.Time

TimeIn returns a time value for midnight in the given location on the day represented by rd.

func (Day) Weekday Uses

func (rd Day) Weekday() time.Weekday

Weekday returns the day of the week specified by rd.

Package ratadie imports 1 packages (graph). Updated 2020-07-04. Refresh now. Tools for package owners.