go-strftime: github.com/lestrrat/go-strftime Index | Files

package strftime

import "github.com/lestrrat/go-strftime"


Package Files

strftime.go writer.go

func Format Uses

func Format(p string, t time.Time) (string, error)

Format takes the format `s` and the time `t` to produce the format date/time. Note that this function re-compiles the pattern every time it is called.

If you know beforehand that you will be reusing the pattern within your application, consider creating a `Strftime` object and reusing it.

type Strftime Uses

type Strftime struct {
    // contains filtered or unexported fields

Strftime is the object that represents a compiled strftime pattern

func New Uses

func New(f string) (*Strftime, error)

New creates a new Strftime object. If the compilation fails, then an error is returned in the second argument.

func (*Strftime) Format Uses

func (f *Strftime) Format(dst io.Writer, t time.Time) error

Format takes the destination `dst` and time `t`. It formats the date/time using the pre-compiled pattern, and outputs the results to `dst`

func (*Strftime) FormatString Uses

func (f *Strftime) FormatString(t time.Time) string

FormatString takes the time `t` and formats it, returning the string containing the formated data.

func (*Strftime) Pattern Uses

func (f *Strftime) Pattern() string

Pattern returns the original pattern string

Package strftime imports 5 packages (graph) and is imported by 6 packages. Updated 2018-03-13. Refresh now. Tools for package owners.