Question: java change the format of the date import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class DateToStringExample 1 { public static void main (
java change the format of the date
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Calendar;
public class DateToStringExample
public static void mainString args
Date date Calendar.getInstancegetTime;
DateFormat dateFormat new SimpleDateFormatEEEE yyyyMMMdd hh:mm:ss zzzz;
String strDate dateFormat.formatdate;
System.out.printlnConverted String: strDate;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class DateToStringExample
public static void mainString args
Date date new Date;
SimpleDateFormat formatter new SimpleDateFormatMMddyyyy;
String strDate formatter.formatdate;
System.out.printlnDate Format with MMddyyyy : strDate;
formatter new SimpleDateFormatddMyyyy hh:mm:ss;
strDate formatter.formatdate;
System.out.printlnDate Format with ddMyyyy hh:mm:ss : strDate;
formatter new SimpleDateFormatdd MMMM yyyy;
strDate formatter.formatdate;
System.out.printlnDate Format with dd MMMM yyyy : strDate;
formatter new SimpleDateFormatdd MMMM yyyy zzzz;
strDate formatter.formatdate;
System.out.printlnDate Format with dd MMMM yyyy zzzz : strDate;
formatter new SimpleDateFormatEEEE dd MMMM yyyy HH:mm:ss zzzz;
strDate formatter.formatdate;
System.out.printlnDate Format with EEEE, dd MMMM yyyy HH:mm:ss zzzz : strDate;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
