Supun Wijerathne Supun Wijerathne - 1 year ago 41
Java Question

Is there any DateTime library which supports quarter of the year and week of the year Java?

I am currently using jodaTime DateTime class for my Java project. But it does not have support for quarter of the year and week of the year.

Is there any Java library which can be used for that purpose?

Answer Source

In java 8 DateTimeFormatter supports quarters using q format and week of the year using w:

LocalDate date =;
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("qqq w");
String text = date.format(formatter);

Results in third quarter and 31st week of the year for todays date (July 25th):

"Q3 31"