For getting Current date in mm/dd/yyyy
format I am using the below code
SimpleDateFormat sdf = new SimpleDateFormat("mm/dd/yyyy");
Date date = new Date();
String date3= sdf.format(date);
date = sdf.parse(date3);
but everytime I print the date ,it gives me wrong and random output
output
Currentd Date:: 49/22/2013
output
Currentd Date:: 07/22/2013
Kindly suggest as what I should use to get current date. The Java Version I am using is 1.4
Change "mm/dd/yyyy"
into "MM/dd/yyyy"
. m
(lowercase) is use for minutes not for month. For month you should use M
(uppercase)