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

Parse from String with custom Pattern #30

Open
hantsy opened this issue Dec 26, 2020 · 3 comments
Open

Parse from String with custom Pattern #30

hantsy opened this issue Dec 26, 2020 · 3 comments

Comments

@hantsy
Copy link

hantsy commented Dec 26, 2020

In Java 8 DateTime, the parse can accept a custom Pattern simply.

LocalDateTime.parse(fields[1].trim(), DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss")),
@jurchiks
Copy link

@hantsy
Copy link
Author

hantsy commented Sep 28, 2021

That's just https://www.php.net/manual/en/datetime.createfromformat.php

Currently I used the following statement to parse a string to LocalDateTime, it looks a little tedious. Hope there is a method aligned to Java DateTime.

LocalDateTime::fromDateTime(DateTime::createFromFormat('d/m/Y H:i:s', $fromDate))

@solodkiy
Copy link
Contributor

Relates to #3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants