[java] How to set time to a date object in java

I created a Date object in Java. When I do so, it shows something like: date=Tue Aug 09 00:00:00 IST 2011. As a result, it appears that my Excel file is lesser by one day (27 feb becomes 26 feb and so on) I think it must be because of time. How can I set it to something like 5:30 pm?

This question is related to java date datetime calendar

The answer is

Calendar cal = Calendar.getInstance();

Date d = cal.getTime();

Also See

Similar questions with java tag:

Similar questions with date tag:

Similar questions with datetime tag:

Similar questions with calendar tag: