Documentation
¶
Overview ¶
Example ¶
package main import ( "fmt" "github.com/richardliao/parsetime" ) func main() { fmt.Println(parsetime.Parse("2006-01-02T15:04:05.999999999+08:00")) fmt.Println(parsetime.Parse("2006-01-02T15:04:05.999999+08:00")) fmt.Println(parsetime.Parse("2006-01-02T15:04:05.999+08:00")) fmt.Println(parsetime.Parse("2006-01-02T15:04:05+08:00")) fmt.Println(parsetime.Parse("2006-01-02T15:04:05+0800")) fmt.Println(parsetime.Parse("2006-01-02T15:04:05Z")) fmt.Println(parsetime.Parse("2006-01-02T15:04:05")) fmt.Println(parsetime.Parse("2006-01-02 15:04:05")) fmt.Println(parsetime.Parse("2006-01-02")) }
Output: 2006-01-02 15:04:05.999999999 +0800 CST <nil> 2006-01-02 15:04:05.999999 +0800 CST <nil> 2006-01-02 15:04:05.999 +0800 CST <nil> 2006-01-02 15:04:05 +0800 CST <nil> 2006-01-02 15:04:05 +0800 CST <nil> 2006-01-02 23:04:05 +0800 CST <nil> 2006-01-02 23:04:05 +0800 CST <nil> 2006-01-02 23:04:05 +0800 CST <nil> 2006-01-02 08:00:00 +0800 CST <nil>
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
Parse is like time.Parse.
The result is the Local location. In the absence of a time zone information, Parse interprets the time as in UTC.
func ParseBytes ¶
ParseBytes is like time.Parse but accepting bytes with better performance of about 4 ns.
func ParseBytesInLocation ¶
ParseBytesInLocation is like time.ParseInLocation but accepting bytes with better performance of about 4 ns.
func ParseInLocation ¶
ParseInLocation is like time.ParseInLocation.
The result is the given location. In the absence of time zone information, ParseInLocation interprets the time as in the given location.
The parameter locOffset is added for performance, and its value is the offset corresponding to loc.
For example.
_, locOffset := time.Now().In(loc).Zone()
Types ¶
This section is empty.