Sprig Date

Sprig Date

ago

func ago(date interface{}) string
The ago function returns duration from time.Now in seconds resolution.

date

func date(fmt string, date interface{}) string
The date function formats a date
[format](https://golang.org/pkg/time/#Time.Format).

dateInZone

func dateInZone(fmt string, date interface{}, zone string) string
Same as date, but with a timezone.

Aliases

  • date_in_zone

dateModify

func dateModify(fmt string, date time.Time) time.Time
The dateModify takes a modification and a date and returns the
timestamp.

date_modify

func date_modify(fmt string, date time.Time) time.Time
The dateModify takes a modification and a date and returns the
timestamp.

duration

func duration(second interface{}) string
Formats a given amount of seconds as a time.Duration.

durationRound

func durationRound(duration interface{}) string
Rounds a given duration to the most significant unit.

htmlDate

func htmlDate(date interface{}) string
The htmlDate function formates a date for inserting into an HTML date
picker input field.

htmlDateInZone

func htmlDateInZone(date interface{}, zone string) string
Same as htmlDate, but with a timezone.

now

func now() time.Time
The current date/time. Use this in conjunction with other date
functions.

toDate

func toDate(fmt string, str string) time.Time
Converts a string to a date. The first argument is the date layout and
the second the date string. If the string can’t be convert it
returns the zero value.

unixEpoch

func unixEpoch(date time.Time) string
Returns the seconds since the unix epoch for a 'time.Time'.