timeconv

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const MillisPerDay int64 = MillisPerHour * 24

MillisPerDay is the number of millseconds per day.

View Source
const MillisPerHour int64 = MillisPerMinute * 60

MillisPerHour is the number of millseconds per hour.

View Source
const MillisPerMinute int64 = MillisPerSecond * 60

MillisPerMinute is the number of millseconds per minute.

View Source
const MillisPerSecond int64 = 1000

MillisPerSecond is the number of millseconds per second.

View Source
const MillisPerWeek int64 = MillisPerDay * 7

MillisPerWeek is the number of millseconds per week.

View Source
const MillisPerYear int64 = MillisPerDay*365 + int64((float64(MillisPerDay) * 0.25))

MillisPerYear is the approximate number of millseconds per year.

Variables

This section is empty.

Functions

func ParseMilliseconds

func ParseMilliseconds(str string) (int64, error)

ParseMilliseconds parses a string containing a number plus a unit of measure for time and returns the number of milliseconds it represents.

Example: * "1 second" returns 1000 * "1 minute" returns 60000 * "1 hour" returns 3600000

See config.UnitsToMillis for a list of supported units of measure.

func UnitsToMillis

func UnitsToMillis(units string) (ms int64, err error)

UnitsToMillis returns the number of milliseconds represented by the specified unit of measure.

Example: * "second" returns 1000 <br/> * "minute" returns 60000 <br/> * "hour" returns 3600000 <br/>

Supported units of measure: * "milliseconds", "millis", "ms", "millisecond" * "seconds", "sec", "s", "second" * "minutes", "mins", "min", "m", "minute" * "hours", "h", "hour" * "days", "d", "day" * "weeks", "w", "week" * "years", "y", "year"

Types

This section is empty.

Jump to

Keyboard shortcuts

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