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

It seems that Instant#parse is not working #6

Closed
gortiz opened this issue Sep 16, 2013 · 2 comments
Closed

It seems that Instant#parse is not working #6

gortiz opened this issue Sep 16, 2013 · 2 comments

Comments

@gortiz
Copy link

gortiz commented Sep 16, 2013

It seems that Instant.Parse is not working. I am trying to use it but it fails. I copied the argument from the javadoc (here http://threeten.github.io/threetenbp/apidocs/org/threeten/bp/Instant.html#parse(java.lang.CharSequence) but it says that is an illegal format.

Code:

 Instant instant = Instant.parse("2007-12-03T10:15:30:00");

Exception:

org.threeten.bp.format.DateTimeParseException: Text '2007-12-03T10:15:30:00' could not be parsed at index 19
    at org.threeten.bp.format.DateTimeFormatter.parseToBuilder(DateTimeFormatter.java:1319)
    at org.threeten.bp.format.DateTimeFormatter.parse(DateTimeFormatter.java:1223)
    at org.threeten.bp.Instant.parse(Instant.java:339)
    at org.modelinglab.ocl.ext.time.classes.InstantDate.testParse(InstantDate.java:19)

Could it be a problem with the codification?

@jodastephen
Copy link
Member

The example is wrong in the Javadoc. It should be "2007-12-03T10:15:30.00 (last is a dot, not a colon).

@RogerRiggs
Copy link
Contributor

The training timezone "Z" is also needed or the parse fails.

jodastephen added a commit that referenced this issue Sep 20, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants