parsetime

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 9 Imported by: 38

README

parsetime

Build Status Coverage Status

date/time parser for golang

Usage

parsetime.NewParseTime
parsetime.NewParseTime()
package main

import (
	"fmt"
	"github.com/tkuchiki/parsetime"
	"log"
)

func main() {
	p, err := parsetime.NewParseTime()
	if err != nil {
		log.Fatal(err)
	}

	t, err2 := p.Parse("2016-01-02T03:04:05")

	if err2 != nil {
		log.Fatal(err)
	}


	// Local timezone: JST
	// 2016-01-02 03:04:05 +0900 JST
	fmt.Println(t)
}
parsetime.NewParseTime("location name")
func main() {
	p, err := parsetime.NewParseTime("US/Arizona")
	if err != nil {
		log.Fatal(err)
	}

	t, err2 := p.Parse("2016-01-02T03:04:05")

	if err2 != nil {
		log.Fatal(err)
	}


	// Local timezone: JST
	// 2016-01-02 03:04:05 -0700 MST
	fmt.Println(t)
}
parsetime.NewParseTime("timezone name")
func main() {
	p, err := parsetime.NewParseTime("MST")
	if err != nil {
		log.Fatal(err)
	}

	t, err2 := p.Parse("2016-01-02T03:04:05")

	if err2 != nil {
		log.Fatal(err)
	}


	// Local timezone: JST
	// 2016-01-02 03:04:05 -0700 MST
	fmt.Println(t)
}
parsetime.NewParseTime("timezone name", offset)
func main() {
	p, err := parsetime.NewParseTime("MST", -7*3600)
	if err != nil {
		log.Fatal(err)
	}

	t, err2 := p.Parse("2016-01-02T03:04:05")

	if err2 != nil {
		log.Fatal(err)
	}


	// Local timezone: JST
	// 2016-01-02 03:04:05 -0700 MST
	fmt.Println(t)
}
ParseTime
ParseTime.GetLocation

Returns *time.Location

var loc *time.Location
p, _ := parsetime.NewParseTime()

loc = p.GetLocation()
ParseTime.SetLocation

Sets *time.Location

var loc *time.Location
var err error
p, _ := parsetime.NewParseTime()

loc, err = time.LoadLocation("US/Arizona")
p.SetLocation(loc)
ParseTime.ISO8601

Parses ISO8601, RFC3339 date/time string

var t time.Time
var err error

p, _ := parsetime.NewParseTime()

t, err = p.ISO8601("2016-01-02T03:04:05")
ParseTime.RFC8xx1123

Parses RFC822, RFC850, RFC1123 date/time string

var t time.Time
var err error

p, _ := parsetime.NewParseTime()

t, err = p.RFC8xx1123("2016-01-02T03:04:05")
ParseTime.ANSIC

Parses ANSIC date/time string

var t time.Time
var err error

p, _ := parsetime.NewParseTime()

t, err = p.ANSIC("2016-01-02T03:04:05")
ParseTime.US

Parses MM/DD/YYYY format date/time string

var t time.Time
var err error

p, _ := parsetime.NewParseTime()

t, err = p.US("2016-01-02T03:04:05")
ParseTime.Parse

Parses date/time string

var t time.Time
var err error

p, _ := parsetime.NewParseTime()

t, err = p.Parse("2016-01-02T03:04:05")

Examples

ISO8601
Input String _time.Time
2006-01-02 15:04 2006-01-02 15:04:00 +0900 JST
2006-01-02 15:04-07:00 2006-01-02 15:04:00 -0700 -0700
2006-01-02 15:04 -07:00 2006-01-02 15:04:00 -0700 -0700
2006-01-02 15:04:05 2006-01-02 15:04:05 +0900 JST
2006-01-02 15:04:05-07:00 2006-01-02 15:04:05 -0700 -0700
2006-01-02 15:04:05 -07:00 2006-01-02 15:04:05 -0700 -0700
2006-01-02 15:04:05-07:00 MST 2006-01-02 15:04:05 -0700 -0700
2006-01-02 15:04:05 -07:00 MST 2006-01-02 15:04:05 -0700 -0700
2006-01-02 15:04:05.999999999 2006-01-02 15:04:05.999999999 +0900 JST
2006-01-02 15:04:05.999999-07:00 MST 2006-01-02 15:04:05.000999999 -0700 -0700
2006-01-02 15:04:05.9-07:00 MST 2006-01-02 15:04:05.000000009 -0700 -0700
2006-01-02 15:04:05.9 -07:00 MST 2006-01-02 15:04:05.000000009 -0700 -0700
2006-01-02 15:04:05.999-07:00 MST 2006-01-02 15:04:05.000000999 -0700 -0700
2006-01-02 15:04:05.999 -07:00 MST 2006-01-02 15:04:05.000000999 -0700 -0700
2006-01-02 15:04:05.999999-07:00 MST 2006-01-02 15:04:05.000999999 -0700 -0700
2006-01-02 15:04:05.999999 -07:00 MST 2006-01-02 15:04:05.000999999 -0700 -0700
2006-01-02 15:04:05.999999999-07:00 MST 2006-01-02 15:04:05.999999999 -0700 -0700
2006-01-02 15:04:05.999999999 -07:00 MST 2006-01-02 15:04:05.999999999 -0700 -0700
2006-01-02T15:04 2006-01-02 15:04:00 +0900 JST
2006-01-02T15:04-07:00 2006-01-02 15:04:00 -0700 -0700
2006-01-02T15:04 -07:00 2006-01-02 15:04:00 -0700 -0700
2006-01-02T15:04:05 2006-01-02 15:04:05 +0900 JST
2006-01-02T15:04:05-07:00 2006-01-02 15:04:05 -0700 -0700
2006-01-02T15:04:05 -07:00 2006-01-02 15:04:05 -0700 -0700
2006-01-02T15:04:05-07:00 MST 2006-01-02 15:04:05 -0700 -0700
2006-01-02T15:04:05 -07:00 MST 2006-01-02 15:04:05 -0700 -0700
2006-01-02T15:04:05.999999999 2006-01-02 15:04:05.999999999 +0900 JST
2006-01-02T15:04:05.999999999-07:00 MST 2006-01-02 15:04:05.999999999 -0700 -0700
2006-01-02T15:04:05.999999999 -07:00 MST 2006-01-02 15:04:05.999999999 -0700 -0700
2006-01-02T15:04:05.999999-07:00 MST 2006-01-02 15:04:05.000999999 -0700 -0700
2006-01-02T15:04:05.999999 -07:00 MST 2006-01-02 15:04:05.000999999 -0700 -0700
2006-01-02T15:04:05.9-07:00 MST 2006-01-02 15:04:05.000000009 -0700 -0700
2006-01-02T15:04:05.9 -07:00 MST 2006-01-02 15:04:05.000000009 -0700 -0700
2006-01-02 2006-01-02 00:00:00 +0900 JST
20060102 2006-01-02 00:00:00 +0900 JST
20060102150405 2006-01-02 15:04:05 +0900 JST
20060102 150405 2006-01-02 15:04:05 +0900 JST
20060102T150405 2006-01-02 15:04:05 +0900 JST
15:04:05 2016-05-06 15:04:05 +0900 JST
15:04:05-07:00 MST 2016-05-06 15:04:05 -0700 -0700
15:04:05 -07:00 MST 2016-05-06 15:04:05 -0700 -0700
15:04:05.9-07:00 MST 2016-05-06 15:04:05.000000009 -0700 -0700
15:04:05.9 -07:00 MST 2016-05-06 15:04:05.000000009 -0700 -0700
15:04:05.999-07:00 MST 2016-05-06 15:04:05.000000999 -0700 -0700
15:04:05.999 -07:00 MST 2016-05-06 15:04:05.000000999 -0700 -0700
15:04:05.999999-07:00 MST 2016-05-06 15:04:05.000999999 -0700 -0700
15:04:05.999999 -07:00 MST 2016-05-06 15:04:05.000999999 -0700 -0700
15:04:05.999999999-07:00 MST 2016-05-06 15:04:05.999999999 -0700 -0700
15:04:05.999999999 -07:00 MST 2016-05-06 15:04:05.999999999 -0700 -0700
150405-07:00 MST 2016-05-06 15:04:05 -0700 -0700
150405 -07:00 MST 2016-05-06 15:04:05 -0700 -0700
150405.9-07:00 MST 2016-05-06 15:04:05.000000009 -0700 -0700
150405.9 -07:00 MST 2016-05-06 15:04:05.000000009 -0700 -0700
150405.999-07:00 MST 2016-05-06 15:04:05.000000999 -0700 -0700
150405.999 -07:00 MST 2016-05-06 15:04:05.000000999 -0700 -0700
150405.999999-07:00 MST 2016-05-06 15:04:05.000999999 -0700 -0700
150405.999999 -07:00 MST 2016-05-06 15:04:05.000999999 -0700 -0700
150405.999999999-07:00 MST 2016-05-06 15:04:05.999999999 -0700 -0700
150405.999999999 -07:00 MST 2016-05-06 15:04:05.999999999 -0700 -0700
2006-01-02 15:04:05Z 2006-01-02 15:04:05 +0000 UTC
2006-01-02T15:04:05Z 2006-01-02 15:04:05 +0000 UTC
2006-01-02 15:04:05.9Z 2006-01-02 15:04:05.000000009 +0000 UTC
2006-01-02T15:04:05.9Z 2006-01-02 15:04:05.000000009 +0000 UTC
2006-01-02 15:04:05.999Z 2006-01-02 15:04:05.000000999 +0000 UTC
2006-01-02T15:04:05.999Z 2006-01-02 15:04:05.000000999 +0000 UTC
2006-01-02 15:04:05.999999Z 2006-01-02 15:04:05.000999999 +0000 UTC
2006-01-02T15:04:05.999999Z 2006-01-02 15:04:05.000999999 +0000 UTC
2006-01-02 15:04:05.999999999Z 2006-01-02 15:04:05.999999999 +0000 UTC
2006-01-02T15:04:05.999999999Z 2006-01-02 15:04:05.999999999 +0000 UTC
RFC8xx1123
Input String _time.Time
02-Jan-06 1504 MST 2006-01-02 15:04:00 -0700 MST
02-Jan-06 15:04 MST 2006-01-02 15:04:00 -0700 MST
02-Jan-06 150405 MST 2006-01-02 15:04:05 -0700 MST
02-Jan-06 15:04:05 MST 2006-01-02 15:04:05 -0700 MST
02-Jan-06 1504-0700 2006-01-02 15:04:00 -0700 -0700
02-Jan-06 15:04-0700 2006-01-02 15:04:00 -0700 -0700
02-Jan-06 150405-0700 2006-01-02 15:04:05 -0700 -0700
02-Jan-06 15:04:05-0700 2006-01-02 15:04:05 -0700 -0700
02-Jan-06 15:04 -0700 2006-01-02 15:04:00 -0700 -0700
02-Jan-06 15:04:05 -0700 2006-01-02 15:04:05 -0700 -0700
Monday, 02-Jan-06 15:04 MST 2006-01-02 15:04:00 -0700 MST
Monday, 02-Jan-06 15:04:05 MST 2006-01-02 15:04:05 -0700 MST
Mon, 02-Jan-06 15:04 MST 2006-01-02 15:04:00 -0700 MST
Mon, 02-Jan-06 15:04:05 MST 2006-01-02 15:04:05 -0700 MST
Mon, 02-Jan-06 15:04-07:00 2006-01-02 15:04:00 -0700 -0700
Mon, 02-Jan-06 15:04:05-07:00 2006-01-02 15:04:05 -0700 -0700
Mon, 02-Jan-06 15:04 -07:00 2006-01-02 15:04:00 -0700 -0700
Mon, 02-Jan-06 15:04:05 -07:00 2006-01-02 15:04:05 -0700 -0700
Mon, 02-Jan-2006 15:04-07:00 2006-01-02 15:04:00 -0700 -0700
Mon, 02-Jan-2006 15:04:05-07:00 2006-01-02 15:04:05 -0700 -0700
Mon, 02-Jan-2006 15:04 -07:00 2006-01-02 15:04:00 -0700 -0700
Mon, 02-Jan-2006 15:04:05 -07:00 2006-01-02 15:04:05 -0700 -0700
Mon, 02-Jan-70 15:04-07:00 1970-01-02 15:04:00 -0700 -0700
Mon, 02-Jan-70 15:04:05-07:00 1970-01-02 15:04:05 -0700 -0700
Mon, 02-Jan-70 15:04 -07:00 1970-01-02 15:04:00 -0700 -0700
Mon, 02-Jan-70 15:04:05 -07:00 1970-01-02 15:04:05 -0700 -0700
Mon, 02-Jan-99 15:04-07:00 1999-01-02 15:04:00 -0700 -0700
Mon, 02-Jan-99 15:04:05-07:00 1999-01-02 15:04:05 -0700 -0700
Mon, 02-Jan-99 15:04:05 -07:00 1999-01-02 15:04:05 -0700 -0700
Mon, 02-Jan-00 15:04-07:00 2000-01-02 15:04:00 -0700 -0700
Mon, 02-Jan-00 15:04:05-07:00 2000-01-02 15:04:05 -0700 -0700
Mon, 02-Jan-00 15:04:05 -07:00 2000-01-02 15:04:05 -0700 -0700
Mon, 02-Jan-00 15:04:05.9-07:00 2000-01-02 15:04:05.000000009 -0700 -0700
Mon, 02-Jan-00 15:04:05.9 -07:00 2000-01-02 15:04:05.000000009 -0700 -0700
Mon, 02-Jan-00 15:04:05.999-07:00 2000-01-02 15:04:05.000000999 -0700 -0700
Mon, 02-Jan-00 15:04:05.999 -07:00 2000-01-02 15:04:05.000000999 -0700 -0700
Mon, 02-Jan-00 15:04:05.999999-07:00 2000-01-02 15:04:05.000999999 -0700 -0700
Mon, 02-Jan-00 15:04:05.999999 -07:00 2000-01-02 15:04:05.000999999 -0700 -0700
Mon, 02-Jan-00 15:04:05.999999999-07:00 2000-01-02 15:04:05.999999999 -0700 -0700
Mon, 02-Jan-00 15:04:05.999999999 -07:00 2000-01-02 15:04:05.999999999 -0700 -0700
ANSIC
Input String _time.Time
Mon Jan 02 150405 2006 2006-01-02 15:04:05 +0900 JST
Mon Jan 02 15:04:05 2006 2006-01-02 15:04:05 +0900 JST
Mon Jan 02 150405 MST 2006 2006-01-02 15:04:05 -0700 MST
Mon Jan 02 15:04:05 MST 2006 2006-01-02 15:04:05 -0700 MST
Mon Jan 02 1504-07:00 2006 2006-01-02 15:04:00 -0700 -0700
Mon Jan 02 15:04-07:00 2006 2006-01-02 15:04:00 -0700 -0700
Mon Jan 02 1504 -07:00 2006 2006-01-02 15:04:00 -0700 -0700
Mon Jan 02 15:04 -07:00 2006 2006-01-02 15:04:00 -0700 -0700
Mon Jan 02 150405-07:00 2006 2006-01-02 15:04:05 -0700 -0700
Mon Jan 02 15:04:05-07:00 2006 2006-01-02 15:04:05 -0700 -0700
Mon Jan 02 150405 -07:00 2006 2006-01-02 15:04:05 -0700 -0700
Mon Jan 02 15:04:05 -07:00 2006 2006-01-02 15:04:05 -0700 -0700
Jan 02 150405 2016-01-02 15:04:05 +0900 JST
Jan 02 15:04:05 2016-01-02 15:04:05 +0900 JST
Jan 02 150405.9 2016-01-02 15:04:05.000000009 +0900 JST
Jan 02 15:04:05.9 2016-01-02 15:04:05.000000009 +0900 JST
Jan 02 150405.999 2016-01-02 15:04:05.000000999 +0900 JST
Jan 02 15:04:05.999 2016-01-02 15:04:05.000000999 +0900 JST
Jan 02 150405.999999 2016-01-02 15:04:05.000999999 +0900 JST
Jan 02 15:04:05.999999 2016-01-02 15:04:05.000999999 +0900 JST
Jan 02 150405.999999999 2016-01-02 15:04:05.999999999 +0900 JST
Jan 02 15:04:05.999999999 2016-01-02 15:04:05.999999999 +0900 JST
US
Input String _time.Time
11:04AM 2016-05-06 11:04:00 +0900 JST
11:04PM 2016-05-06 23:04:00 +0900 JST
11:04 AM 2016-05-06 11:04:00 +0900 JST
11:04 PM 2016-05-06 23:04:00 +0900 JST
11:04:05 AM 2016-05-06 11:04:05 +0900 JST
11:04:05 PM 2016-05-06 23:04:05 +0900 JST
11:04:05.9AM 2016-05-06 11:04:05.000000009 +0900 JST
11:04:05.9 AM 2016-05-06 11:04:05.000000009 +0900 JST
11:04:05.9PM 2016-05-06 23:04:05.000000009 +0900 JST
11:04:05.9 PM 2016-05-06 23:04:05.000000009 +0900 JST
11:04:05.999AM 2016-05-06 11:04:05.000000999 +0900 JST
11:04:05.999 AM 2016-05-06 11:04:05.000000999 +0900 JST
11:04:05.999PM 2016-05-06 23:04:05.000000999 +0900 JST
11:04:05.999 PM 2016-05-06 23:04:05.000000999 +0900 JST
11:04:05.999999AM 2016-05-06 11:04:05.000999999 +0900 JST
11:04:05.999999 AM 2016-05-06 11:04:05.000999999 +0900 JST
11:04:05.999999PM 2016-05-06 23:04:05.000999999 +0900 JST
11:04:05.999999 PM 2016-05-06 23:04:05.000999999 +0900 JST
11:04:05.999999999AM 2016-05-06 11:04:05.999999999 +0900 JST
11:04:05.999999999 AM 2016-05-06 11:04:05.999999999 +0900 JST
11:04:05.999999999PM 2016-05-06 23:04:05.999999999 +0900 JST
11:04:05.999999999 PM 2016-05-06 23:04:05.999999999 +0900 JST
01-02-06 3:04AM 2006-01-02 03:04:00 +0900 JST
01-02-06 3:04 AM 2006-01-02 03:04:00 +0900 JST
01-02-06 3:04PM 2006-01-02 15:04:00 +0900 JST
01-02-06 3:04 PM 2006-01-02 15:04:00 +0900 JST
01-02-06 03:04:05AM 2006-01-02 03:04:05 +0900 JST
01-02-06 03:04:05 AM 2006-01-02 03:04:05 +0900 JST
01-02-06 03:04:05PM 2006-01-02 15:04:05 +0900 JST
01-02-06 03:04:05 PM 2006-01-02 15:04:05 +0900 JST
01-02-06 03:04:05.9AM 2006-01-02 03:04:05.000000009 +0900 JST
01-02-06 03:04:05.9 AM 2006-01-02 03:04:05.000000009 +0900 JST
01-02-06 03:04:05.9PM 2006-01-02 15:04:05.000000009 +0900 JST
01-02-06 03:04:05.9 PM 2006-01-02 15:04:05.000000009 +0900 JST
01-02-06 03:04:05.999AM 2006-01-02 03:04:05.000000999 +0900 JST
01-02-06 03:04:05.999 AM 2006-01-02 03:04:05.000000999 +0900 JST
01-02-06 03:04:05.999PM 2006-01-02 15:04:05.000000999 +0900 JST
01-02-06 03:04:05.999 PM 2006-01-02 15:04:05.000000999 +0900 JST
01-02-06 03:04:05.999999AM 2006-01-02 03:04:05.000999999 +0900 JST
01-02-06 03:04:05.999999 AM 2006-01-02 03:04:05.000999999 +0900 JST
01-02-06 03:04:05.999999PM 2006-01-02 15:04:05.000999999 +0900 JST
01-02-06 03:04:05.999999 PM 2006-01-02 15:04:05.000999999 +0900 JST
01-02-06 03:04:05.999999999AM 2006-01-02 03:04:05.999999999 +0900 JST
01-02-06 03:04:05.999999999 AM 2006-01-02 03:04:05.999999999 +0900 JST
01-02-06 03:04:05.999999999PM 2006-01-02 15:04:05.999999999 +0900 JST
01-02-06 03:04:05.999999999 PM 2006-01-02 15:04:05.999999999 +0900 JST
Jan 2, 2006 2006-01-02 00:00:00 +0900 JST
Jan 2, 2006 at 3:04am (MST) 2006-01-02 03:04:00 -0700 MST
Jan 2, 2006 at 03:04am (MST) 2006-01-02 03:04:00 -0700 MST
Jan 2, 2006 at 3:04pm (MST) 2006-01-02 15:04:00 -0700 MST
Jan 2, 2006 at 03:04pm (MST) 2006-01-02 15:04:00 -0700 MST
Jan 2, 2006 at 3:04 am (MST) 2006-01-02 03:04:00 -0700 MST
Jan 2, 2006 at 03:04 am (MST) 2006-01-02 03:04:00 -0700 MST
Jan 2, 2006 at 3:04 pm (MST) 2006-01-02 15:04:00 -0700 MST
Jan 2, 2006 at 03:04 pm (MST) 2006-01-02 15:04:00 -0700 MST
Jan 2, 2006 at 3:04:05am (MST) 2006-01-02 03:04:05 -0700 MST
Jan 2, 2006 at 3:04:05pm (MST) 2006-01-02 15:04:05 -0700 MST
Jan 2, 2006 at 3:04:05 am (MST) 2006-01-02 03:04:05 -0700 MST
Jan 2, 2006 at 3:04:05 pm (MST) 2006-01-02 15:04:05 -0700 MST
Jan 2, 2006 at 3:04:05.9am (MST) 2006-01-02 03:04:05.000000009 -0700 MST
Jan 2, 2006 at 3:04:05.9pm (MST) 2006-01-02 15:04:05.000000009 -0700 MST
Jan 2, 2006 at 3:04:05.999am (MST) 2006-01-02 03:04:05.000000999 -0700 MST
Jan 2, 2006 at 3:04:05.999pm (MST) 2006-01-02 15:04:05.000000999 -0700 MST
Jan 2, 2006 at 3:04:05.999999am (MST) 2006-01-02 03:04:05.000999999 -0700 MST
Jan 2, 2006 at 3:04:05.999999pm (MST) 2006-01-02 15:04:05.000999999 -0700 MST
Jan 2, 2006 at 3:04:05.999999999am (MST) 2006-01-02 03:04:05.999999999 -0700 MST
Jan 2, 2006 at 3:04:05.999999999pm (MST) 2006-01-02 15:04:05.999999999 -0700 MST
Jan 2, 2006 at 3:04am MST 2006-01-02 03:04:00 -0700 MST
Jan 2, 2006 at 3:04pm MST 2006-01-02 15:04:00 -0700 MST
Jan 2, 2006 at 3:04am -07:00 2006-01-02 03:04:00 -0700 -0700
Jan 2, 2006 at 3:04pm -07:00 2006-01-02 15:04:00 -0700 -0700
Jan 2, 2006 at 3:04:05am MST 2006-01-02 03:04:05 -0700 MST
Jan 2, 2006 at 3:04:05pm MST 2006-01-02 15:04:05 -0700 MST
Jan 2, 2006 at 3:04:05am -07:00 2006-01-02 03:04:05 -0700 -0700
Jan 2, 2006 at 3:04:05pm -07:00 2006-01-02 15:04:05 -0700 -0700
Parse
Input String _time.Time
2006-01-02 15:04 2006-01-02 15:04:00 +0900 JST
2006-01-02 15:04-07:00 2006-01-02 15:04:00 -0700 -0700
2006-01-02 15:04 -07:00 2006-01-02 15:04:00 -0700 -0700
2006-01-02 15:04:05 2006-01-02 15:04:05 +0900 JST
2006-01-02 15:04:05-07:00 2006-01-02 15:04:05 -0700 -0700
2006-01-02 15:04:05 -07:00 2006-01-02 15:04:05 -0700 -0700
2006-01-02 15:04:05-07:00 MST 2006-01-02 15:04:05 -0700 -0700
2006-01-02 15:04:05 -07:00 MST 2006-01-02 15:04:05 -0700 -0700
2006-01-02 15:04:05.999999999 2006-01-02 15:04:05.999999999 +0900 JST
2006-01-02 15:04:05.999999-07:00 MST 2006-01-02 15:04:05.000999999 -0700 -0700
2006-01-02 15:04:05.9-07:00 MST 2006-01-02 15:04:05.000000009 -0700 -0700
2006-01-02 15:04:05.9 -07:00 MST 2006-01-02 15:04:05.000000009 -0700 -0700
2006-01-02 15:04:05.999-07:00 MST 2006-01-02 15:04:05.000000999 -0700 -0700
2006-01-02 15:04:05.999 -07:00 MST 2006-01-02 15:04:05.000000999 -0700 -0700
2006-01-02 15:04:05.999999-07:00 MST 2006-01-02 15:04:05.000999999 -0700 -0700
2006-01-02 15:04:05.999999 -07:00 MST 2006-01-02 15:04:05.000999999 -0700 -0700
2006-01-02 15:04:05.999999999-07:00 MST 2006-01-02 15:04:05.999999999 -0700 -0700
2006-01-02 15:04:05.999999999 -07:00 MST 2006-01-02 15:04:05.999999999 -0700 -0700
2006-01-02T15:04 2006-01-02 15:04:00 +0900 JST
2006-01-02T15:04-07:00 2006-01-02 15:04:00 -0700 -0700
2006-01-02T15:04 -07:00 2006-01-02 15:04:00 -0700 -0700
2006-01-02T15:04:05 2006-01-02 15:04:05 +0900 JST
2006-01-02T15:04:05-07:00 2006-01-02 15:04:05 -0700 -0700
2006-01-02T15:04:05 -07:00 2006-01-02 15:04:05 -0700 -0700
2006-01-02T15:04:05-07:00 MST 2006-01-02 15:04:05 -0700 -0700
2006-01-02T15:04:05 -07:00 MST 2006-01-02 15:04:05 -0700 -0700
2006-01-02T15:04:05.999999999 2006-01-02 15:04:05.999999999 +0900 JST
2006-01-02T15:04:05.999999999-07:00 MST 2006-01-02 15:04:05.999999999 -0700 -0700
2006-01-02T15:04:05.999999999 -07:00 MST 2006-01-02 15:04:05.999999999 -0700 -0700
2006-01-02T15:04:05.999999-07:00 MST 2006-01-02 15:04:05.000999999 -0700 -0700
2006-01-02T15:04:05.999999 -07:00 MST 2006-01-02 15:04:05.000999999 -0700 -0700
2006-01-02T15:04:05.9-07:00 MST 2006-01-02 15:04:05.000000009 -0700 -0700
2006-01-02T15:04:05.9 -07:00 MST 2006-01-02 15:04:05.000000009 -0700 -0700
2006-01-02 2006-01-02 00:00:00 +0900 JST
20060102 2006-01-02 00:00:00 +0900 JST
20060102150405 2006-01-02 15:04:05 +0900 JST
20060102 150405 2006-01-02 15:04:05 +0900 JST
20060102T150405 2006-01-02 15:04:05 +0900 JST
15:04:05 2016-05-06 15:04:05 +0900 JST
15:04:05-07:00 MST 2016-05-06 15:04:05 -0700 -0700
15:04:05 -07:00 MST 2016-05-06 15:04:05 -0700 -0700
15:04:05.9-07:00 MST 2016-05-06 15:04:05.000000009 -0700 -0700
15:04:05.9 -07:00 MST 2016-05-06 15:04:05.000000009 -0700 -0700
15:04:05.999-07:00 MST 2016-05-06 15:04:05.000000999 -0700 -0700
15:04:05.999 -07:00 MST 2016-05-06 15:04:05.000000999 -0700 -0700
15:04:05.999999-07:00 MST 2016-05-06 15:04:05.000999999 -0700 -0700
15:04:05.999999 -07:00 MST 2016-05-06 15:04:05.000999999 -0700 -0700
15:04:05.999999999-07:00 MST 2016-05-06 15:04:05.999999999 -0700 -0700
15:04:05.999999999 -07:00 MST 2016-05-06 15:04:05.999999999 -0700 -0700
150405-07:00 MST 2016-05-06 15:04:05 -0700 -0700
150405 -07:00 MST 2016-05-06 15:04:05 -0700 -0700
150405.9-07:00 MST 2016-05-06 15:04:05.000000009 -0700 -0700
150405.9 -07:00 MST 2016-05-06 15:04:05.000000009 -0700 -0700
150405.999-07:00 MST 2016-05-06 15:04:05.000000999 -0700 -0700
150405.999 -07:00 MST 2016-05-06 15:04:05.000000999 -0700 -0700
150405.999999-07:00 MST 2016-05-06 15:04:05.000999999 -0700 -0700
150405.999999 -07:00 MST 2016-05-06 15:04:05.000999999 -0700 -0700
150405.999999999-07:00 MST 2016-05-06 15:04:05.999999999 -0700 -0700
150405.999999999 -07:00 MST 2016-05-06 15:04:05.999999999 -0700 -0700
2006-01-02 15:04:05Z 2006-01-02 15:04:05 +0000 UTC
2006-01-02T15:04:05Z 2006-01-02 15:04:05 +0000 UTC
2006-01-02 15:04:05.9Z 2006-01-02 15:04:05.000000009 +0000 UTC
2006-01-02T15:04:05.9Z 2006-01-02 15:04:05.000000009 +0000 UTC
2006-01-02 15:04:05.999Z 2006-01-02 15:04:05.000000999 +0000 UTC
2006-01-02T15:04:05.999Z 2006-01-02 15:04:05.000000999 +0000 UTC
2006-01-02 15:04:05.999999Z 2006-01-02 15:04:05.000999999 +0000 UTC
2006-01-02T15:04:05.999999Z 2006-01-02 15:04:05.000999999 +0000 UTC
2006-01-02 15:04:05.999999999Z 2006-01-02 15:04:05.999999999 +0000 UTC
2006-01-02T15:04:05.999999999Z 2006-01-02 15:04:05.999999999 +0000 UTC
02-Jan-06 1504 MST 2006-01-02 15:04:00 -0700 MST
02-Jan-06 15:04 MST 2006-01-02 15:04:00 -0700 MST
02-Jan-06 150405 MST 2006-01-02 15:04:05 -0700 MST
02-Jan-06 15:04:05 MST 2006-01-02 15:04:05 -0700 MST
02-Jan-06 1504-0700 2006-01-02 15:04:00 -0700 -0700
02-Jan-06 15:04-0700 2006-01-02 15:04:00 -0700 -0700
02-Jan-06 150405-0700 2006-01-02 15:04:05 -0700 -0700
02-Jan-06 15:04:05-0700 2006-01-02 15:04:05 -0700 -0700
02-Jan-06 15:04 -0700 2006-01-02 15:04:00 -0700 -0700
02-Jan-06 15:04:05 -0700 2006-01-02 15:04:05 -0700 -0700
Monday, 02-Jan-06 15:04 MST 2006-01-02 15:04:00 -0700 MST
Monday, 02-Jan-06 15:04:05 MST 2006-01-02 15:04:05 -0700 MST
Mon, 02-Jan-06 15:04 MST 2006-01-02 15:04:00 -0700 MST
Mon, 02-Jan-06 15:04:05 MST 2006-01-02 15:04:05 -0700 MST
Mon, 02-Jan-06 15:04-07:00 2006-01-02 15:04:00 -0700 -0700
Mon, 02-Jan-06 15:04:05-07:00 2006-01-02 15:04:05 -0700 -0700
Mon, 02-Jan-06 15:04 -07:00 2006-01-02 15:04:00 -0700 -0700
Mon, 02-Jan-06 15:04:05 -07:00 2006-01-02 15:04:05 -0700 -0700
Mon, 02-Jan-2006 15:04-07:00 2006-01-02 15:04:00 -0700 -0700
Mon, 02-Jan-2006 15:04:05-07:00 2006-01-02 15:04:05 -0700 -0700
Mon, 02-Jan-2006 15:04 -07:00 2006-01-02 15:04:00 -0700 -0700
Mon, 02-Jan-2006 15:04:05 -07:00 2006-01-02 15:04:05 -0700 -0700
Mon, 02-Jan-70 15:04-07:00 1970-01-02 15:04:00 -0700 -0700
Mon, 02-Jan-70 15:04:05-07:00 1970-01-02 15:04:05 -0700 -0700
Mon, 02-Jan-70 15:04 -07:00 1970-01-02 15:04:00 -0700 -0700
Mon, 02-Jan-70 15:04:05 -07:00 1970-01-02 15:04:05 -0700 -0700
Mon, 02-Jan-99 15:04-07:00 1999-01-02 15:04:00 -0700 -0700
Mon, 02-Jan-99 15:04:05-07:00 1999-01-02 15:04:05 -0700 -0700
Mon, 02-Jan-99 15:04:05 -07:00 1999-01-02 15:04:05 -0700 -0700
Mon, 02-Jan-00 15:04-07:00 2000-01-02 15:04:00 -0700 -0700
Mon, 02-Jan-00 15:04:05-07:00 2000-01-02 15:04:05 -0700 -0700
Mon, 02-Jan-00 15:04:05 -07:00 2000-01-02 15:04:05 -0700 -0700
Mon, 02-Jan-00 15:04:05.9-07:00 2000-01-02 15:04:05.000000009 -0700 -0700
Mon, 02-Jan-00 15:04:05.9 -07:00 2000-01-02 15:04:05.000000009 -0700 -0700
Mon, 02-Jan-00 15:04:05.999-07:00 2000-01-02 15:04:05.000000999 -0700 -0700
Mon, 02-Jan-00 15:04:05.999 -07:00 2000-01-02 15:04:05.000000999 -0700 -0700
Mon, 02-Jan-00 15:04:05.999999-07:00 2000-01-02 15:04:05.000999999 -0700 -0700
Mon, 02-Jan-00 15:04:05.999999 -07:00 2000-01-02 15:04:05.000999999 -0700 -0700
Mon, 02-Jan-00 15:04:05.999999999-07:00 2000-01-02 15:04:05.999999999 -0700 -0700
Mon, 02-Jan-00 15:04:05.999999999 -07:00 2000-01-02 15:04:05.999999999 -0700 -0700
Mon Jan 02 150405 2006 2006-01-02 15:04:05 +0900 JST
Mon Jan 02 15:04:05 2006 2006-01-02 15:04:05 +0900 JST
Mon Jan 02 150405 MST 2006 2006-01-02 15:04:05 -0700 MST
Mon Jan 02 15:04:05 MST 2006 2006-01-02 15:04:05 -0700 MST
Mon Jan 02 1504-07:00 2006 2006-01-02 15:04:00 -0700 -0700
Mon Jan 02 15:04-07:00 2006 2006-01-02 15:04:00 -0700 -0700
Mon Jan 02 1504 -07:00 2006 2006-01-02 15:04:00 -0700 -0700
Mon Jan 02 15:04 -07:00 2006 2006-01-02 15:04:00 -0700 -0700
Mon Jan 02 150405-07:00 2006 2006-01-02 15:04:05 -0700 -0700
Mon Jan 02 15:04:05-07:00 2006 2006-01-02 15:04:05 -0700 -0700
Mon Jan 02 150405 -07:00 2006 2006-01-02 15:04:05 -0700 -0700
Mon Jan 02 15:04:05 -07:00 2006 2006-01-02 15:04:05 -0700 -0700
Jan 02 150405 2016-01-02 15:04:05 +0900 JST
Jan 02 15:04:05 2016-01-02 15:04:05 +0900 JST
Jan 02 150405.9 2016-01-02 15:04:05.000000009 +0900 JST
Jan 02 15:04:05.9 2016-01-02 15:04:05.000000009 +0900 JST
Jan 02 150405.999 2016-01-02 15:04:05.000000999 +0900 JST
Jan 02 15:04:05.999 2016-01-02 15:04:05.000000999 +0900 JST
Jan 02 150405.999999 2016-01-02 15:04:05.000999999 +0900 JST
Jan 02 15:04:05.999999 2016-01-02 15:04:05.000999999 +0900 JST
Jan 02 150405.999999999 2016-01-02 15:04:05.999999999 +0900 JST
Jan 02 15:04:05.999999999 2016-01-02 15:04:05.999999999 +0900 JST
11:04AM 2016-05-06 11:04:00 +0900 JST
11:04PM 2016-05-06 23:04:00 +0900 JST
11:04 AM 2016-05-06 11:04:00 +0900 JST
11:04 PM 2016-05-06 23:04:00 +0900 JST
11:04:05 AM 2016-05-06 11:04:05 +0900 JST
11:04:05 PM 2016-05-06 23:04:05 +0900 JST
11:04:05.9AM 2016-05-06 11:04:05.000000009 +0900 JST
11:04:05.9 AM 2016-05-06 11:04:05.000000009 +0900 JST
11:04:05.9PM 2016-05-06 23:04:05.000000009 +0900 JST
11:04:05.9 PM 2016-05-06 23:04:05.000000009 +0900 JST
11:04:05.999AM 2016-05-06 11:04:05.000000999 +0900 JST
11:04:05.999 AM 2016-05-06 11:04:05.000000999 +0900 JST
11:04:05.999PM 2016-05-06 23:04:05.000000999 +0900 JST
11:04:05.999 PM 2016-05-06 23:04:05.000000999 +0900 JST
11:04:05.999999AM 2016-05-06 11:04:05.000999999 +0900 JST
11:04:05.999999 AM 2016-05-06 11:04:05.000999999 +0900 JST
11:04:05.999999PM 2016-05-06 23:04:05.000999999 +0900 JST
11:04:05.999999 PM 2016-05-06 23:04:05.000999999 +0900 JST
11:04:05.999999999AM 2016-05-06 11:04:05.999999999 +0900 JST
11:04:05.999999999 AM 2016-05-06 11:04:05.999999999 +0900 JST
11:04:05.999999999PM 2016-05-06 23:04:05.999999999 +0900 JST
11:04:05.999999999 PM 2016-05-06 23:04:05.999999999 +0900 JST
01-02-06 3:04AM 2006-01-02 03:04:00 +0900 JST
01-02-06 3:04 AM 2006-01-02 03:04:00 +0900 JST
01-02-06 3:04PM 2006-01-02 15:04:00 +0900 JST
01-02-06 3:04 PM 2006-01-02 15:04:00 +0900 JST
01-02-06 03:04:05AM 2006-01-02 03:04:05 +0900 JST
01-02-06 03:04:05 AM 2006-01-02 03:04:05 +0900 JST
01-02-06 03:04:05PM 2006-01-02 15:04:05 +0900 JST
01-02-06 03:04:05 PM 2006-01-02 15:04:05 +0900 JST
01-02-06 03:04:05.9AM 2006-01-02 03:04:05.000000009 +0900 JST
01-02-06 03:04:05.9 AM 2006-01-02 03:04:05.000000009 +0900 JST
01-02-06 03:04:05.9PM 2006-01-02 15:04:05.000000009 +0900 JST
01-02-06 03:04:05.9 PM 2006-01-02 15:04:05.000000009 +0900 JST
01-02-06 03:04:05.999AM 2006-01-02 03:04:05.000000999 +0900 JST
01-02-06 03:04:05.999 AM 2006-01-02 03:04:05.000000999 +0900 JST
01-02-06 03:04:05.999PM 2006-01-02 15:04:05.000000999 +0900 JST
01-02-06 03:04:05.999 PM 2006-01-02 15:04:05.000000999 +0900 JST
01-02-06 03:04:05.999999AM 2006-01-02 03:04:05.000999999 +0900 JST
01-02-06 03:04:05.999999 AM 2006-01-02 03:04:05.000999999 +0900 JST
01-02-06 03:04:05.999999PM 2006-01-02 15:04:05.000999999 +0900 JST
01-02-06 03:04:05.999999 PM 2006-01-02 15:04:05.000999999 +0900 JST
01-02-06 03:04:05.999999999AM 2006-01-02 03:04:05.999999999 +0900 JST
01-02-06 03:04:05.999999999 AM 2006-01-02 03:04:05.999999999 +0900 JST
01-02-06 03:04:05.999999999PM 2006-01-02 15:04:05.999999999 +0900 JST
01-02-06 03:04:05.999999999 PM 2006-01-02 15:04:05.999999999 +0900 JST
Jan 2, 2006 2006-01-02 00:00:00 +0900 JST
Jan 2, 2006 at 3:04am (MST) 2006-01-02 03:04:00 -0700 MST
Jan 2, 2006 at 03:04am (MST) 2006-01-02 03:04:00 -0700 MST
Jan 2, 2006 at 3:04pm (MST) 2006-01-02 15:04:00 -0700 MST
Jan 2, 2006 at 03:04pm (MST) 2006-01-02 15:04:00 -0700 MST
Jan 2, 2006 at 3:04 am (MST) 2006-01-02 03:04:00 -0700 MST
Jan 2, 2006 at 03:04 am (MST) 2006-01-02 03:04:00 -0700 MST
Jan 2, 2006 at 3:04 pm (MST) 2006-01-02 15:04:00 -0700 MST
Jan 2, 2006 at 03:04 pm (MST) 2006-01-02 15:04:00 -0700 MST
Jan 2, 2006 at 3:04:05am (MST) 2006-01-02 03:04:05 -0700 MST
Jan 2, 2006 at 3:04:05pm (MST) 2006-01-02 15:04:05 -0700 MST
Jan 2, 2006 at 3:04:05 am (MST) 2006-01-02 03:04:05 -0700 MST
Jan 2, 2006 at 3:04:05 pm (MST) 2006-01-02 15:04:05 -0700 MST
Jan 2, 2006 at 3:04:05.9am (MST) 2006-01-02 03:04:05.000000009 -0700 MST
Jan 2, 2006 at 3:04:05.9pm (MST) 2006-01-02 15:04:05.000000009 -0700 MST
Jan 2, 2006 at 3:04:05.999am (MST) 2006-01-02 03:04:05.000000999 -0700 MST
Jan 2, 2006 at 3:04:05.999pm (MST) 2006-01-02 15:04:05.000000999 -0700 MST
Jan 2, 2006 at 3:04:05.999999am (MST) 2006-01-02 03:04:05.000999999 -0700 MST
Jan 2, 2006 at 3:04:05.999999pm (MST) 2006-01-02 15:04:05.000999999 -0700 MST
Jan 2, 2006 at 3:04:05.999999999am (MST) 2006-01-02 03:04:05.999999999 -0700 MST
Jan 2, 2006 at 3:04:05.999999999pm (MST) 2006-01-02 15:04:05.999999999 -0700 MST
Jan 2, 2006 at 3:04am MST 2006-01-02 03:04:00 -0700 MST
Jan 2, 2006 at 3:04pm MST 2006-01-02 15:04:00 -0700 MST
Jan 2, 2006 at 3:04am -07:00 2006-01-02 03:04:00 -0700 -0700
Jan 2, 2006 at 3:04pm -07:00 2006-01-02 15:04:00 -0700 -0700
Jan 2, 2006 at 3:04:05am MST 2006-01-02 03:04:05 -0700 MST
Jan 2, 2006 at 3:04:05pm MST 2006-01-02 15:04:05 -0700 MST
Jan 2, 2006 at 3:04:05am -07:00 2006-01-02 03:04:05 -0700 -0700
Jan 2, 2006 at 3:04:05pm -07:00 2006-01-02 15:04:05 -0700 -0700

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ISO8601, RFC3339
	ISO8601 = strings.Join([]string{
		`(?:`, year, ymdSep, month, ymdSep, day, `)?`, t,
		`(?:`, hour, hmsSep, min, hmsSep, sec, `?`, nsec, `)?`,
		s, offset, s, zone,
	}, "")

	// RFC822, RFC850, RFC1123
	RFC8xx1123 = strings.Join([]string{
		`(?:`, weekday, `,?`, s, `)?`, day, ymdSep, monthAbbr, ymdSep, shortYear,
		hmsSep, `(?:`, hour, hmsSep, min, hmsSep, sec, `?`, nsec, `)?`,
		s, offsetZone,
	}, "")

	ANSIC = strings.Join([]string{
		`(?:`, weekday, s, `)?`, monthAbbr, ymdSep, day, ymdSep,
		`(?:`, hour, hmsSep, min, hmsSep, sec, `?`, nsec, `)?`,
		s, `(?:`, offsetZone, s, year, `)?`,
	}, "")

	US = strings.Join([]string{
		`(?:`, monthAbbr, ymdSep, day, `(?:,)?`, ymdSep, shortYear, `)?`, s, `(?:at)?`, s,
		`(?:`, hour, hmsSep, min, hmsSep, sec, `?`, nsec, `)?`,
		s, ampm, `?`, s, usOffsetZone,
	}, "")

	Months = map[string]int{
		"Jan":       1,
		"January":   1,
		"Feb":       2,
		"Februray":  2,
		"Mar":       3,
		"March":     3,
		"Apr":       4,
		"April":     4,
		"May":       5,
		"Jun":       6,
		"June":      6,
		"Jul":       7,
		"July":      7,
		"Aug":       8,
		"August":    8,
		"Sep":       9,
		"September": 9,
		"Oct":       10,
		"October":   10,
		"Nov":       11,
		"November":  11,
		"Dec":       12,
		"December":  12,
	}
)

Regular expressions

Functions

This section is empty.

Types

type ParseTime

type ParseTime struct {
	// contains filtered or unexported fields
}

ParseTime parses the date/time string

func NewParseTime

func NewParseTime(location ...interface{}) (ParseTime, error)

NewParseTime returns a new parser

func (*ParseTime) ANSIC

func (pt *ParseTime) ANSIC(value string) (time.Time, error)

ANSIC parses ANSIC date/time string

func (*ParseTime) GetLocation

func (pt *ParseTime) GetLocation() *time.Location

GetLocation returns *time.Location

func (*ParseTime) ISO8601

func (pt *ParseTime) ISO8601(value string) (time.Time, error)

ISO8601 parses ISO8601, RFC3339 date/time string

func (*ParseTime) Parse

func (pt *ParseTime) Parse(value string) (time.Time, error)

Parse parses date/time string

func (*ParseTime) RFC8xx1123

func (pt *ParseTime) RFC8xx1123(value string) (time.Time, error)

RFC8xx1123 parses RFC822, RFC850, RFC1123 date/time string

func (*ParseTime) SetLocation

func (pt *ParseTime) SetLocation(loc *time.Location)

SetLocation sets *time.Location

func (*ParseTime) US

func (pt *ParseTime) US(value string) (time.Time, error)

US parses MM/DD/YYYY format date/time string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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