1

Hello I want to convert these kinds of Strings into Date using the LocalDateTime JAVA API . Below is the input Strings : "1672017" that I want to convert to the corresponding date based on the date whose number is 167 in the year 2017.

Any idea how to do this please

1
  • What do dates within the first 99 days of the year look like? 0062017 and 0882017? Or 62017 and 882017? Commented Jan 15, 2019 at 14:21

1 Answer 1

8

D represents day of year, so you can use

DateTimeFormatter format = DateTimeFormatter.ofPattern("DDDyyyy");
LocalDate localDate = LocalDate.parse("1672017", format);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.