Parse
Overview
Part of the time package — Node.js analog: moment, dayjs (package timex).
Signature
go
func Parse(layout, value string) (stdtime.Time, error)Compare: Node.js · Standard Go · gox
js
// Typical moment, dayjs (package timex) pattern in Node.jsgo
t := time.Now()
t.Format(time.RFC3339)go
import "github.com/sahilkhaire/gox/time"
t, err := timex.Parse(timex.LayoutISO, "2024-06-15T12:00:00Z")Example
go
import "github.com/sahilkhaire/gox/time"
t, err := timex.Parse(timex.LayoutISO, "2024-06-15T12:00:00Z")Tips
Import github.com/sahilkhaire/gox/time and call Parse directly. See the comparison below for the standard library equivalent.
Standard library alternative
Use the standard library directly:
go
t := time.Now()
t.Format(time.RFC3339)