reltime: code.soquee.net/reltime Index | Examples | Files

package reltime

import "code.soquee.net/reltime"

Package reltime implements a "time ago" algorithm.

Index

Examples

Package Files

reltime.go

func Ago Uses

func Ago(d time.Duration) string

Ago transforms durations into human readable strings.

Code:

s := Ago(-24 * time.Hour)
fmt.Println(s)

Output:

about a day ago

func TimeAgo Uses

func TimeAgo(t time.Time) string

TimeAgo transforms the difference between a time and the current time into a human readable string.

It is a convenience wrapper for Ago(time.Until(t)). For more information see the example on Ago.

Package reltime imports 3 packages (graph). Updated 2019-07-13. Refresh now. Tools for package owners.