Is it possible that i can get todays date , rather than time ??
This is my code
public static void main(String args[]) throws ParseException{
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
Date today = calendar.getTime();
}
Why is todays date is shown as before date ??
public class Ravi {
public static void main(String args[]) throws ParseException {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date();
System.out.println("Todays Date"+dateFormat.format(date));
List currentObject = new ArrayList();
currentObject.add("2012-09-27");
Date ExpDate = dateFormat.parse((String) currentObject.get(0));
System.out.println("ddd"+ExpDate);
if (ExpDate.before(date)) {
System.out.println("true");
}
else {
System.out.println("false");
}
}
}