arrow

package
v0.0.0-...-42041c8 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package arrow provides C-style date formating and parsing, along with other date goodies.

See the github project page at http://github.com/bmuller/arrow for more info.

Index

Constants

View Source
const (
	Nanosecond  time.Duration = 1
	Microsecond               = 1000 * Nanosecond
	Millisecond               = 1000 * Microsecond
	Second                    = 1000 * Millisecond
	Minute                    = 60 * Second
	Hour                      = 60 * Minute
	Day                       = 24 * Hour
	Week                      = 7 * Day
)

Like time's constants, but with Day and Week

Variables

This section is empty.

Functions

func SleepUntil

func SleepUntil(t Arrow)

Types

type Arrow

type Arrow struct {
	time.Time
}

func CParse

func CParse(layout, value string) (Arrow, error)

Parse the time using the same format string types as strftime See http://man7.org/linux/man-pages/man3/strftime.3.html for more info.

func CParseInLocation

func CParseInLocation(layout, value string, loc *time.Location) (Arrow, error)

Parse the time using the same format string types as strftime, within the given location. See http://man7.org/linux/man-pages/man3/strftime.3.html for more info.

func CParseInStringLocation

func CParseInStringLocation(layout, value, timezone string) (Arrow, error)

Parse the time using the same format string types as strftime, within the given location (string value for timezone). See http://man7.org/linux/man-pages/man3/strftime.3.html for more info.

func Epoch

func Epoch() Arrow

func InTimezone

func InTimezone(timezone string) Arrow

Get the current time in the given timezone. The timezone parameter should correspond to a file in the IANA Time Zone database, such as "America/New_York". "UTC" and "Local" are also acceptable. If the timezone given isn't valid, then no change to the timezone is made.

func New

func New(t time.Time) Arrow

func NextDay

func NextDay() Arrow

func NextHour

func NextHour() Arrow

func NextMinute

func NextMinute() Arrow

func NextSecond

func NextSecond() Arrow

func Now

func Now() Arrow

func Tomorrow

func Tomorrow() Arrow

func UTC

func UTC() Arrow

func Unix

func Unix(sec int64, nsec int64) Arrow

func Yesterday

func Yesterday() Arrow

func (Arrow) Add

func (a Arrow) Add(d time.Duration) Arrow

func (Arrow) AddDays

func (a Arrow) AddDays(days int) Arrow

func (Arrow) AddDuration

func (a Arrow) AddDuration(duration string) Arrow

Add any duration parseable by time.ParseDuration

func (Arrow) AddDurations

func (a Arrow) AddDurations(durations ...string) Arrow

Add any durations parseable by time.ParseDuration

func (Arrow) AddHours

func (a Arrow) AddHours(hours int) Arrow

func (Arrow) AddMinutes

func (a Arrow) AddMinutes(minutes int) Arrow

func (Arrow) AddSeconds

func (a Arrow) AddSeconds(seconds int) Arrow

func (Arrow) After

func (a Arrow) After(b Arrow) bool

func (Arrow) AtBeginningOfDay

func (a Arrow) AtBeginningOfDay() Arrow

func (Arrow) AtBeginningOfHour

func (a Arrow) AtBeginningOfHour() Arrow

func (Arrow) AtBeginningOfMinute

func (a Arrow) AtBeginningOfMinute() Arrow

func (Arrow) AtBeginningOfMonth

func (a Arrow) AtBeginningOfMonth() Arrow

func (Arrow) AtBeginningOfSecond

func (a Arrow) AtBeginningOfSecond() Arrow

func (Arrow) AtBeginningOfWeek

func (a Arrow) AtBeginningOfWeek() Arrow

func (Arrow) AtBeginningOfYear

func (a Arrow) AtBeginningOfYear() Arrow

func (Arrow) Before

func (a Arrow) Before(b Arrow) bool

func (Arrow) CFormat

func (a Arrow) CFormat(format string) string

Format the time using the same format string types as strftime. See http://man7.org/linux/man-pages/man3/strftime.3.html for more info.

func (Arrow) Equal

func (a Arrow) Equal(b Arrow) bool

func (Arrow) InTimezone

func (a Arrow) InTimezone(timezone string) Arrow

The timezone parameter should correspond to a file in the IANA Time Zone database, such as "America/New_York". "UTC" and "Local" are also acceptable. If the timezone given isn't valid, then no change to the timezone is made.

func (Arrow) Sub

func (a Arrow) Sub(b Arrow) time.Duration

func (Arrow) Tomorrow

func (a Arrow) Tomorrow() Arrow

func (Arrow) UTC

func (a Arrow) UTC() Arrow

func (Arrow) UpTo

func (a Arrow) UpTo(b Arrow, by time.Duration) []Arrow

Return an array of Arrow's from this one up to the given one, by duration. For instance, Now().UpTo(Tomorrow(), Hour) will return an array of Arrow's from now until tomorrow by hour (inclusive of a and b).

func (Arrow) Yesterday

func (a Arrow) Yesterday() Arrow

Jump to

Keyboard shortcuts

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