Skip to content
Node: ms('2d')github.com/sahilkhaire/gox/time

ParseDuration

Overview

If you are coming from Node.js, the closest pattern is ms('2d').

Signature

go
func ParseDuration(s string) (stdtime.Duration, error)

Compare: Node.js · Standard Go · gox

js
ms('2d')
go
// Use the underlying stdlib or driver directly.
// See package overview for escape hatches.
go
import "github.com/sahilkhaire/gox/time"

timex.ParseDuration("2d")

Example

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

timex.ParseDuration("2d")

Tips

Import github.com/sahilkhaire/gox/time and call ParseDuration directly. See the comparison below for the standard library equivalent.

Standard library alternative

gox wraps the Go standard library or a trusted dependency with Node-familiar naming. You can use the underlying library directly — see the package overview for escape hatches.

Back to time package overview

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