From 42dbd9f872ebcc2d9bb8a5bf541984c9e1e50f8e Mon Sep 17 00:00:00 2001 From: Aaron Raddon Date: Sun, 22 Jul 2018 12:56:01 -0700 Subject: [PATCH] update readme --- README.md | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/README.md b/README.md index 82d6dd7..80345d9 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Parse many date strings without knowing format in advance. Uses a scanner to re [![Build Status](https://travis-ci.org/araddon/dateparse.svg?branch=master)](https://travis-ci.org/araddon/dateparse) [![Go ReportCard](https://goreportcard.com/badge/araddon/dateparse)](https://goreportcard.com/report/araddon/dateparse) -**MM/DD/YYYY VS DD/MM/YYYY** Right now this uses mm/dd/yyyy WHEN ambiguous will. Plan an alternate api for preferring dd/mm https://github.com/araddon/dateparse/issues/28 +**MM/DD/YYYY VS DD/MM/YYYY** Right now this uses mm/dd/yyyy WHEN ambiguous if this is not desired behavior, use `ParseStrict` which will fail on ambiguous date strings. **Timezones** The location your server is configured effects the results! See example or https://play.golang.org/p/IDHRalIyXh and last paragraph here https://golang.org/pkg/time/#Parse. @@ -23,24 +23,6 @@ t, err := dateparse.ParseAny("3/1/2014") t, err := dateparse.ParseStrict("3/1/2014") > returns error -// Parse 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. -denverLoc, _ := time.LoadLocation("America/Denver") -t, err := dateparse.ParseIn("3/1/2014", denverLoc) - -// 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") -// use time.Local global variable to store location -time.Local = denverLoc -t, err := dateparse.ParseLocal("3/1/2014") -// Equivalent to -t, err := dateparse.ParseIn("3/1/2014", time.Local) - - // Return a string that represents the layout to parse the given date-time. layout, err := dateparse.ParseFormat("May 8, 2009 5:57:51 PM") > "Jan 2, 2006 3:04:05 PM"