dateparse

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustParse

func MustParse(datestr string) time.Time

MustParse parse a date, and panic if it can't be parsed. Used for testing. Not recommended for most use-cases.

func Parse

func Parse(datestr string) (time.Time, error)

Parse parse an unknown date format, detect the layout, parse. Normal parse. Equivalent Timezone rules as time.Parse()

func ParseIn

func ParseIn(datestr string, loc *time.Location) (time.Time, error)

ParseIn with Location, equivalent to time.ParseInLocation() timezone/offset rules. Using location arg, if timezone/offset info exists in the datestring, it uses the given location rules for any zone interpretation. That is, MST means one thing when using America/Denver and something else in other locations.

func ParseLocal

func ParseLocal(datestr string) (time.Time, error)

ParseLocal Given an unknown date format, detect the layout, using time.Local, parse.

Set Location to time.Local. Same as ParseIn Location but lazily uses the global time.Local variable for Location argument.

denverLoc, _ := time.LoadLocation("America/Denver")
time.Local = denverLoc

t, err := dateparse.ParseLocal("3/1/2014")

Equivalent to:

t, err := dateparse.ParseIn("3/1/2014", denverLoc)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL