[Solved] Java Change Date Format [duplicate]


Date objects don’t have a format. Formatting can only be applied when you display them as a strings. A Date object simply stores all the info about the date (day, month, year, time, etc). When displaying that data, it is displayed as a string, and that is when it makes sense to arrange the data in a specific format.

As for outputting the format you mentioned, you can use a format of “dd” (since you just want the date, with leading zero if needed).

solved Java Change Date Format [duplicate]