strftime

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2021 License: Apache-2.0 Imports: 2 Imported by: 67

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var FormatChars = map[rune]string{
	'B': "January",
	'b': "Jan",
	'm': "01",
	'A': "Monday",
	'a': "Mon",
	'd': "02",
	'H': "15",
	'I': "03",
	'M': "04",
	'S': "05",
	'Y': "2006",
	'y': "06",
	'p': "PM",
	'Z': "MST",
	'z': "-0700",
	'L': ".000",
}

FormatChars are the supported characters for strftime. It is a subset of all strftime characters See also, time/format.go

Functions

func Format

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

Format formats a time object using strftime syntax

Example
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

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL