iso8601

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Second = time.Second
	Minute = Second * 60
	Hour   = Minute * 60
	Day    = Hour * 24
	Month  = Day * 30
	Year   = Day * 365
)

Time constant as time.Duration

Variables

View Source
var DurationRegex = regexp.MustCompile(`P([\d\.]+Y)?([\d\.]+M)?([\d\.]+D)?T([\d\.]+H)?([\d\.]+M)?([\d\.]+?S)?`)

DurationRegex regular expression for duration iso 8601

Functions

func EncodeDuration

func EncodeDuration(d time.Duration) string

EncodeDuration converts a time.Duration to an ISO8601 duration string examples :

3h -> PT3H
7h22min -> PT7h22M

func ParseDuration

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

ParseDuration converts a ISO8601 duration into a time.Duration

Types

This section is empty.

Jump to

Keyboard shortcuts

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