Reputation: 3117
How can I add 23 hr 59 min to the timestamp object which will be converted to Date object in java?
I want to get for example 2011-12-08 23:59:59.0
As I get the timestamp from pop up calender, I always get 2011-12-08 00:00:00.0 like this. That's why.
Thanks.
Upvotes: 0
Views: 153
Reputation: 94645
First of all obtain the Calendar
instance and use setTimeInMillis()
method to set timestamp's time.
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(timestampObj.getTime());
cal.add(Calendar.HOUR, 23);
cal.add(Calendar.SECOND, 55);
Date date=cal.getTime();
Upvotes: 4