Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

time.Parse error with time.RFC3339 & time.RFC3339Nano #5294

Closed
bryanjeal opened this issue Apr 16, 2013 · 6 comments
Closed

time.Parse error with time.RFC3339 & time.RFC3339Nano #5294

bryanjeal opened this issue Apr 16, 2013 · 6 comments

Comments

@bryanjeal
Copy link

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. Try to parse a datetime string in time.RFC3339 or time.RFC3339Nano format
http://play.golang.org/p/mn9BC9ghnF

What is the expected output?
Valid time.Time.

What do you see instead?
Error.

Which operating system are you using?
Ubuntu 12.04
OS X 10.8.3


Which version are you using?  (run 'go version')
go version devel +d58997478ec6 Mon Apr 08 00:09:35 2013 -0700 linux/amd64
go version go1.0.3
@bradfitz
Copy link
Contributor

Comment 1:

An RFC3339Nano bug was fixed in Go tip (which will be in Go 1.1).
But this isn't even valid:
    time.Parse(time.RFC3339, time.RFC3339)

Status changed to Invalid.

@bryanjeal
Copy link
Author

Comment 2:

Thank you for the update. Two things:
1. Why is time.Parse(time.RFC3339, time.RFC3339) invalid (I am sorry for being so
ignorant)?
2. I am sorry for wasting your time.

@bradfitz
Copy link
Contributor

Comment 3:

The fixed bug was issue #3523.

@bradfitz
Copy link
Contributor

Comment 4:

An RFC3339 can't contain both a "Z" (which means 00:00) and an offset.
In your examples,
2013-04-14T15:42:09.869934827Z04:00 -- contains both Z and 04:00
time.RFC3339 itself doesn't work as an input value because it's
2006-01-02T15:04:05Z07:00, which has both Z and an offset.
A time format isn't necessarily a valid input.  It's a description of how to parse a
time.

@bryanjeal
Copy link
Author

Comment 5:

Ah! I didn't understand the Z and offset thing - I guess I should have read up more on
the RFC3339 spec.
Thank you so very much for taking the time to explain that to me.

@ianlancetaylor
Copy link
Member

Comment 6:

Issue #9056 has been merged into this issue.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants