Thanks everyone. I am now trying to format the date, basically I have a
String variable "dateFormat" that I pass in as parameter, it can be:
MM/DD/YYYY or MM.DD.YYYY
I tried the following but it doesn't work:
//////////////////////////////////////////////
GregorianCalendar calendar = new GregorianCalendar();
//////////////////Display the date now:
Date now = calendar.getTime();
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
Date formattedDate = sdf.parse(now);
System.out.println(formattedDate);