Tuesday, July 31, 2012

How to set time to a date object in java

Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY,17);
cal.set(Calendar.MINUTE,30);
cal.set(Calendar.SECOND,0);
cal.set(Calendar.MILLISECOND,0);
Date d = cal.getTime();
Also See
http://stackoverflow.com/questions/5165428/how-to-set-time-to-a-date-object-in-java

No comments:

Post a Comment