Documentation
¶
Overview ¶
Package tuesday implements strftime formatting compatible with Ruby 3.4.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Strftime ¶
Strftime formats t according to a Ruby-compatible strftime format. Unsupported directives are retained as literal text. Strftime returns an error if a supported directive requests a field width greater than 1 MiB.
Example (Flags) ¶
t, _ := time.Parse(time.RFC822, "10 Jul 17 18:45 EDT")
s, _ := Strftime("%B %^B %m %_m %-m %6Y", t)
fmt.Println(s)
Output: July JULY 07 7 7 002017
Example (Timezone) ¶
t, _ := time.Parse(time.RFC822, "10 Jul 17 18:45 EDT")
s, _ := Strftime("%Z %z %:z %::z", t)
fmt.Println(s)
Output: EDT -0400 -04:00 -04:00:00
Types ¶
type Formatter ¶ added in v1.1.0
type Formatter struct {
// contains filtered or unexported fields
}
Formatter is an immutable, reusable compiled strftime format. A Formatter is safe for concurrent use by multiple goroutines.
func Compile ¶ added in v1.1.0
Compile parses a strftime format for repeated use. Unsupported directives are retained as literal text. Compile returns an error when a supported directive requests a field width large enough to risk excessive allocation.
Click to show internal directories.
Click to hide internal directories.