[Solved] How to format my date to Default format [closed]


Use LocalDateTime with its toString().

String s = LocalDateTime.now().toString(); // ISO standard representation

// LocalDateTime to old Date:
Date date = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());

// Old Date holding time to LocalDateTime:
LocalDateTime localDateTime = LocalDateTime.ofInstant(date.toInstant(),
        ZoneId.systemDefault());

Of cause with an SQL PreparedStatement, you could simply call setDate without the detour via String.

solved How to format my date to Default format [closed]