KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
As I know getHours() , getMinutes() and getSeconds() are all deprecated in Java and they are replaced with Calendar.HOUR_OF_DAY , Calendar.MINUTE , Calendar.SECOND . These will in fact return the hour, minute and second for that particular moment. However, I would want to retrieved the hours and minutes from a Date variable. For instance, say the time retrieved from database is time = Thu Jan 01 09:12:18 CET 1970; int hours = time.getHours(); int minutes = time.getMinutes(); int seconds = time.getSeconds(); By retrieving the hours, minutes, and seconds, I get hours = 9 minutes = 12 seconds = 18 So, how do I use Calendar for this function? Although the getHours() has been deprecated but it still worked. I would still like to know if there is an alternative to this.
Tags (comma-separated)
Save Edits
Cancel