-
Please Help!!!
i need to convert any number into hours,minutes, and seconds in java..anyone got some tips/codes that i can use? im confused as ****.
-
You can use java.util.Calendar class.
Just create an instance, then set your number as time in miliseconds and then read the hour, minute, date, second, milisecond, etc.
Please read the java doc. The number you supply is 0 based but moment 0 is not the beginning of the epoch and you will have to adjust it accordingly.
N.B. DO NOT USE ANY TITLE LIKE !!!!!HELP!!!! OR SOMETHING SIMILAR. Just say what is your problem. Also read the notes of the moderator about how to make a decent posting!
Code in peace!
-
Hope this helps ..
Calendar calendar = null;
java.util.Date date = new java.util.Date();
int day=0,month=0,year=0;
calendar = Calendar.getInstance();
calendar.setTime(date);
day = calendar.get(Calendar.DAY_OF_MONTH);
month = 1+calendar.get(Calendar.MONTH);
year = calendar.get(Calendar.YEAR);
int hour = calendar.get(Calendar.HOUR_OF_DAY);
int minute = calendar.get(Calendar.MINUTE);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks