Back to godoc.org
code.soquee.net/reltime

Package reltime

v0.0.1
Latest Go to latest

The latest major version is .

Published: May 27, 2019 | License: BSD-2-Clause | Module: code.soquee.net/reltime

Overview

Package reltime implements a "time ago" algorithm.

Index

Examples

func Ago

func Ago(d time.Duration) string

Ago transforms durations into human readable strings.

Example

Code:

s := Ago(-24 * time.Hour)
fmt.Println(s)
about a day ago

func TimeAgo

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.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier