DateFormatSymbols setShortMonths() Method in Java with Examples
The setShortMonths(String newShMonth) Method of DateFormatSymbols class in Java is used to set the short names of the months of the calendar in string format into some different strings. For eg., “Jan” can be changed to “FEB”, “JUN” can be changed to “GEEK” etc.
public void setShortMonths(String newShMonth)
Parameters: The method takes one parameter newShMonth which is an array of String type and refers to the new strings that are to be replaced in the existing Months.
Return Values: The method returns the modified names of the months in a string format.
Below programs illustrate the use of setShortMonths() method.
Original: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Modified: GEEK FOR GEEK DEC NOV JAN FEB
Original: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Modified: 123 456 JAN FEB NOV Dec May
My Personal Notes arrow_drop_up
Please Login to comment...