Reputation: 1982
As methods like getHours, getMinutes of java.util.Date class are deprecated and java.util.Calendar class is not yet supported in gwt, is there a better way to add/reduce hours/minutes from a Date object in gwt without doing String manipulation.
Upvotes: 2
Views: 2836
Reputation: 64551
final long SECONDS = 1000;
final long MINUTES = 60*SECONDS;
final long HOURS = 60*MINUTES;
myDate.setTime(myDate.getTime() + 3*HOURS + 25*MINUTES);
But if you can use getHours
/setHours
and it better fits what you want to do, there's no reason for not doing it. Just because it's documented as deprecated is not a compelling reason (for GWT's PoV at least)
Upvotes: 4