lala lala lala lala - 11 months ago 78
Java Question

Get pattern of SimpleDateFormat

I have a combo box with list of the current date with a different format. When the user selected the format, the current date with the selected format will be display. I need to save the selected pattern of the date in a file. I look everywhere and I can't find a specific answer for my problem. Is there a way to get the specific pattern of a date in java?

Answer Source

From the docs:

public String toPattern()
Returns a pattern string describing this date format.