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

How to format some types of date #276

Closed
Garf1eldGit opened this issue May 17, 2023 · 1 comment
Closed

How to format some types of date #276

Garf1eldGit opened this issue May 17, 2023 · 1 comment
Labels
formatters Related to parsing and formatting
Milestone

Comments

@Garf1eldGit
Copy link

Garf1eldGit commented May 17, 2023

Here is example of strings, those i want to format into some type of date.

"2020-02-04T09:07:13.851+0300"
"17.01.2022"

With Instant.parce("2020-02-04T09:07:13.851+0300") throws exception could not be parsed, unparsed text found at index 26
And
LocalDate.parse( "17.01.2022") throws Text '17.01.2022' could not be parsed at index 0

How to do it nicely?

@dkhalanskyjb dkhalanskyjb added the formatters Related to parsing and formatting label May 17, 2023
@Antimonit
Copy link

If I am not mistaken, this is not yet implemented.

From the readme:

Currently, Instant, LocalDateTime, LocalDate and LocalTime only support ISO-8601 format.

Also from the readme:

Known/open issues, work TBD

[x] Some kind of Clock interface is needed as a pluggable replacement for Instant.now().
[ ] Flexible locale-neutral parsing and formatting facilities are needed to support various date/time interchange formats that are used in practice (in particular, various RFCs).

Only ISO formats are now supported for now. In your case, it needs to be formatted as:

LocalDate.parse("2022-01-17")
Instant.parse("2020-02-04T09:07:13.851+03:00")

@dkhalanskyjb dkhalanskyjb added this to the 0.6.0 milestone Nov 29, 2023
dkhalanskyjb added a commit that referenced this issue Feb 20, 2024
Fixes #39
Fixes #58
Fixes #90
Fixes #128
Fixes #133
Fixes #139
Fixes #211
Fixes #240
Fixes #83
Fixes #276
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatters Related to parsing and formatting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@Antimonit @Garf1eldGit @dkhalanskyjb and others