Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendFormat ¶
AppendFormat appends formatted time to the bytes. You can use this method to reduce allocations.
func Format ¶
Format time to string using the format.
Example ¶
package main
import (
"fmt"
"time"
"github.com/itchyny/timefmt-go"
)
func main() {
t := time.Date(2020, time.July, 24, 9, 7, 29, 0, time.UTC)
str := timefmt.Format(t, "%Y-%m-%d %H:%M:%S")
fmt.Println(str)
}
Output: 2020-07-24 09:07:29
func Parse ¶
Parse time string using the format.
Example ¶
package main
import (
"fmt"
"log"
"github.com/itchyny/timefmt-go"
)
func main() {
str := "2020-07-24 09:07:29"
t, err := timefmt.Parse(str, "%Y-%m-%d %H:%M:%S")
if err != nil {
log.Fatal(err)
}
fmt.Println(t)
}
Output: 2020-07-24 09:07:29 +0000 UTC
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.
