Date Format Function in Java
The below function written in Java is used to format the date in alike order. you can customize the date order on your wish by changing the date format order. For example, MM/dd/yyyy will display the month first, date second and the year at third by using the / separator. Ordering MM, dd and yyyy in different combination let you customize your date display order
Java Code to Date Format
import java.text.SimpleDateFormat;
import java.util.Date;
public class JavaSimpleDateFormatExample{
public static void main(String args[]){
Date date = new Date();
String DATE_FORMAT = "MM/dd/yyyy";
SimpleDateFormat tdate = new SimpleDateFormat(DATE_FORMAT);
System.out.println("Today is " + tdate.format(date) );
}
}