Skip to content

human-readable relative time formatter for golang

License

Notifications You must be signed in to change notification settings

bowerswilkins/humantime

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

humantime

Self-conained time.Duration-to-human-readable-string conversion package.

Forked from https://godoc.org/github.com/dustin/go-humanize.

usage

Example:

fmt.Printf("posted %s", humantime.Time(time.Now().Add(-7 * time.Hour)))

Yields:

posted 7 hours ago

There's also a condensed option:

fmt.Printf("posted %s", humantime.CondensedTime(time.Now().Add(-7 * time.Hour)))

Yields:

posted 7h ago

About

human-readable relative time formatter for golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%