Java SimpleDateFormat format Date to String as "24/02/2020"
import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static void main(String[] args) { // Create a formatter with a pattern dd/MM/yyyy. SimpleDateFormat simpleFormatter = new SimpleDateFormat("dd/MM/yyyy"); // Get current date Date today = new Date(); // Format the current date String formattedDate = simpleFormatter.format(today); // Print the date System.out.println("Today is (dd/MM/yyyy): " + formattedDate); }// w ww . jav a 2 s . c o m }