return date type with format in java [duplicate]

A Date is basically stored as a number of milliseconds since the epoch (1/1/1970). It can be formatted into a String in various ways (e.g. with SimpleDateFormat), but it is never stored as a String. So, what you’re asking for is impossible and makes no sense.

Leave a Comment