I have a method that returns a Timestamp and I need to pass this to a method that is expecting a Calendar object. ie. deliveryDetails.getWindowStart() // returns a Timestamp and I need to pass another method this value as a Calendar.
Peter den Haan
posted 15 years ago
Calendar cal = Calendar.getInstance(); cal.setTime(timestamp); This will give a Calendar object that has the correct time, but unfortunately it will also set the Date portion to the 1st of January 1970. If you need to get rid of that, cal.clear(Calendar.YEAR); cal.clear(Calendar.DAY_OF_YEAR); Should do it. - Peter