Add
Overview
Part of the time package — Node.js analog: moment, dayjs (package timex).
Signature
go
func Add(t stdtime.Time, d stdtime.Duration) stdtime.TimeCompare: 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"
later := timex.Add(time.Now(), time.Hour)Example
go
import "github.com/sahilkhaire/gox/time"
later := timex.Add(time.Now(), time.Hour)Tips
Import github.com/sahilkhaire/gox/time and call Add 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)