strftime

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2022 License: MIT Imports: 4 Imported by: 10

README

strftime/strptime compatible time formatting and parsing for Go.

PkgGoDev

Documentation

Overview

Package strftime provides strftime/strptime compatible time formatting and parsing.

Example (ConvertToGoTimeLayout)
layout, err := strftime.Layout("%Y-%m-%d %H:%M:%S")
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%q", layout)
Output:

"2006-01-02 15:04:05"
Example (ConvertToNSDateFormatterPattern)
layout, err := strftime.UTS35("%Y-%m-%d %H:%M:%S")
if err != nil {
	log.Fatal(err)
}
fmt.Printf("%q", layout)
Output:

"yyyy-MM-dd HH:mm:ss"

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendFormat added in v0.1.1

func AppendFormat(dst []byte, fmt string, t time.Time) []byte

AppendFormat is like Format, but appends the textual representation to dst and returns the extended buffer.

func Format

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

Format returns a textual representation of the time value formatted according to the strftime format specification.

func Layout

func Layout(fmt string) (string, error)

Layout converts a strftime format specification to a Go time layout specification.

func Parse

func Parse(fmt, value string) (time.Time, error)

Parse converts a textual representation of time to the time value it represents according to the strftime format specification.

func UTS35

func UTS35(fmt string) (string, error)

UTS35 converts a strftime format specification to a Unicode Technical Standard #35 Date Format Pattern.

Types

This section is empty.

Jump to

Keyboard shortcuts

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