Documentation
¶
Overview ¶
Package gohumantime is a Human readable time interval parser for golang
import "github.com/urjitbhatia/gohumantime"
...
ToMilliseconds("ten minutes and four seconds")
ToMilliseconds('one minute')
ToMilliseconds('2.3 minutes')
ToMilliseconds('3 days, 4 hours and 36 seconds')
Supported Units ¶
The following time unit words are supported
- `seconds`
- `minutes`
- `hours`
- `days`
- `weeks`
- `months` -- assumes 30 days
- `years` -- assumes 365 days
Numeric word representations ¶
gohumantime supports numbers up to ten being written out in English. Beyond then, it understands:
`fifteen`
and then every tens unit from
'twenty', 'thirty'... onto 'hundred'
Index ¶
Constants ¶
View Source
const ( Second = 1000 Minute = Second * 60 Hour = Minute * 60 Day = Hour * 24 Week = Day * 7 Month = Day * 30 Year = Day * 365 )
Export Unit times in in milliseconds (easier testing)
Variables ¶
This section is empty.
Functions ¶
func ToMilliseconds ¶
ToMilliseconds converts a human readable interval string into milliseconds. Example: ToMilliseconds("three minutes and five seconds") returns 3 * 60 * 1000 + 5 * 1000
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.