go-strftime: github.com/jehiah/go-strftime Index | Examples | Files

package strftime

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

go implementation of strftime

Index

Examples

Package Files

strftime.go

func Format Uses

func Format(format string, t time.Time) string

This is an alternative to time.Format because no one knows what date 040305 is supposed to create when used as a 'layout' string this takes standard strftime format options. For a complete list of format options see http://strftime.org/

Code:

t := time.Unix(1340244776, 0)
utc, _ := time.LoadLocation("UTC")
t = t.In(utc)
fmt.Println(Format("%Y-%m-%d %H:%M:%S", t))

Output:

2012-06-21 02:12:56

Package strftime imports 2 packages (graph) and is imported by 23 packages. Updated 2017-05-26. Refresh now. Tools for package owners.