Skip to content
Node: moment().format()github.com/sahilkhaire/gox/time

Format

Overview ​

If you are coming from Node.js, the closest pattern is moment().format().

Signature ​

go
func Format(t stdtime.Time, layout string) string

Compare: Node.js · Standard Go · gox ​

js
moment().format()
go
t := time.Now()
t.Format(time.RFC3339)
go
import "github.com/sahilkhaire/gox/time"

timex.Format(t, layout)

Example ​

go
import "github.com/sahilkhaire/gox/time"

timex.Format(t, layout)

Tips ​

Import github.com/sahilkhaire/gox/time and call Format 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)

← Back to time package overview

MIT Licensed · Built for Node.js developers moving to Go