This content has been marked as final. Show 4 replies
i have to imagine a simple google search for "java date format" would give you an untold number of useful results.
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Try something like below snippet, worked for me
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
Calendar c1 = Calendar.getInstance(); // today
String today = sdf.format(c1.getTime());
System.out.println("Today date is:"+today);
Rahul, the question was answered over a month ago. Please read all replies before posting.