chaitu chaitu
asked on
Date is not coming correctlty
String x="2007/04/05";
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yy yy");
x= sdf.format(sdf.parse(x));
System.out.println("DateEx ample.main ().."+x);
result:DateExample.main(). .03/04/017 2
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yy
x= sdf.format(sdf.parse(x));
System.out.println("DateEx
result:DateExample.main().
Change the format to "mm/dd/yyyy"
Assume 04 is month and 05 is day.
String x="2007/04/05";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/ dd");
x= sdf.format(sdf.parse(x));
System.out.println("DateEx ample.main ().."+x);
result:DateExample.main(). .2007/04/0 5
String x="2007/04/05";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/
x= sdf.format(sdf.parse(x));
System.out.println("DateEx
result:DateExample.main().
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Jaax, 'm' is for minutes, 'M' for months.