Documentation
¶
Overview ¶
Package strftime provides a C99-compatible strftime formatter for use with Go time.Time instances.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Format ¶
Format accepts a Time pointer and a C99-compatible strftime format string and returns the formatted result. If the Time pointer is nil, the current time is used.
See http://en.cppreference.com/w/c/chrono/strftime for available conversion specifiers. Specific locale specifiers are not yet supported.
Example ¶
t := time.Date(2018, time.July, 9, 13, 14, 15, 0, time.UTC) fmt.Println(Format(&t, "%c")) fmt.Println(Format(&t, "%%Y-%%m-%%d -> %Y-%m-%d")) fmt.Println(Format(&t, "%A is day number %w of the week.")) fmt.Println(Format(&t, "Last century was%n the %Cth century.")) fmt.Println(Format(&t, "Time zone: %Z"))
Output: Mon Jul 9 13:14:15 2018 %Y-%m-%d -> 2018-07-09 Monday is day number 1 of the week. Last century was the 20th century. Time zone: UTC
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.