Get first and last date of the previous month

Viewed 45674

Possible Duplicate:
How to get the first date and last date of the previous month? (Java)

In java, how to get the first and last date of the previous month?

If I am not wrong the following code is to get the last date of the previous month.

Calendar aCalendar = Calendar.getInstance();
aCalendar.set(Calendar.DAY_OF_MONTH, -1);    
aCalendar.add(Calendar.DAY_OF_MONTH, -1) ;
System.out.println(new Timestamp(aCalendar.getTime().getTime()));

Correct me if I am wrong.

Thank you.

2 Answers
Related