time

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2019 License: BSD-3-Clause Imports: 5 Imported by: 1

Documentation

Overview

Package time provide a library for working with time.

Index

Constants

View Source
const (
	// Day the duration for a day.
	Day = 24 * time.Hour
	// Week the duration for a week.
	Week = 7 * Day
)

Variables

View Source
var (
	ShortDayNames = []string{
		"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun",
	}

	//
	// ShortMonths provide mapping between text of month, in English,
	// short format to their time.Month value
	//
	ShortMonths = map[string]time.Month{
		"Jan": time.January,
		"Feb": time.February,
		"Mar": time.March,
		"Apr": time.April,
		"May": time.May,
		"Jun": time.June,
		"Jul": time.July,
		"Aug": time.August,
		"Sep": time.September,
		"Oct": time.October,
		"Nov": time.November,
		"Dec": time.December,
	}
)
View Source
var (
	// ErrDurationMissingValue an error when value is missing when parsing
	// duration.
	ErrDurationMissingValue = errors.New("missing value in duration")
)

Functions

func Microsecond

func Microsecond(t *time.Time) int

Microsecond return the microsecond value of time.

func ParseDuration

func ParseDuration(s string) (time.Duration, error)

ParseDuration extend the capability of standard time.Duration with additional unit suffix: day and week. Day unit end with "d" and week unit end with "w". A day is equal with "24h", an a week is equal to "7d". Unlike standard time.Duration the week or day units must be before hours.

Types

This section is empty.

Jump to

Keyboard shortcuts

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