hugo: github.com/gohugoio/hugo/tpl/time Index | Files

package time

import "github.com/gohugoio/hugo/tpl/time"

Index

Package Files

init.go time.go

type Namespace Uses

type Namespace struct{}

Namespace provides template functions for the "time" namespace.

func New Uses

func New() *Namespace

New returns a new instance of the time-namespaced template functions.

func (*Namespace) AsTime Uses

func (ns *Namespace) AsTime(v interface{}) (interface{}, error)

AsTime converts the textual representation of the datetime string into a time.Time interface.

func (*Namespace) Duration Uses

func (ns *Namespace) Duration(unit interface{}, number interface{}) (_time.Duration, error)

Duration converts the given number to a time.Duration. Unit is one of nanosecond/ns, microsecond/us/µs, millisecond/ms, second/s, minute/m or hour/h.

func (*Namespace) Format Uses

func (ns *Namespace) Format(layout string, v interface{}) (string, error)

Format converts the textual representation of the datetime string into the other form or returns it of the time.Time value. These are formatted with the layout string

func (*Namespace) Now Uses

func (ns *Namespace) Now() _time.Time

Now returns the current local time.

func (*Namespace) ParseDuration Uses

func (ns *Namespace) ParseDuration(in interface{}) (_time.Duration, error)

ParseDuration parses a duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". See https://golang.org/pkg/time/#ParseDuration

Package time imports 5 packages (graph) and is imported by 6 packages. Updated 2017-11-20. Refresh now. Tools for package owners.