is there any date format for half year ad quarter year

Is there any format pattern I can use with SimpleDateFormat for quarter year and half year?

    2007-01-23 expected output `Q1 2007`  
    2007-01-23 expected output `H1 2007`  
Jon Skeet
people
quotationmark

No, there's nothing like that, as far as I'm aware. I wouldn't put it past different companies to have different ideas of "Q1" and "H1" to start with, to be honest - such as "Q1 ends at the end of the last week which starts in March".

You'll have to write your own code to do that.

EDIT: Looking at the Java 8 java.time.DateTimeFormatter documentation, it looks like it supports quarters but not halves.

people

See more on this question at Stackoverflow