Hi, I am trying to get the curren time of the system in seconds.Plz help!. Bye, Viki.
• Sun Certified Programmer for Java 2 Platform (SCJP2)
• IBM Certified Professional for Object Oriented Analysis and Design with UML
• IBM Certified System Administrator for WebSphere Application Server v5.0
• Certified Business Analysis Professional (CBAP®)
Hi Dirk, I have tried the same before but got odd result.May be I am doing some silly mistake anywhere.Here is my code with o/p
O/P:1033139787 Bye, Viki.
• Sun Certified Programmer for Java 2 Platform (SCJP2)
• IBM Certified Professional for Object Oriented Analysis and Design with UML
• IBM Certified System Administrator for WebSphere Application Server v5.0
• Certified Business Analysis Professional (CBAP®)
I think you are trying to get the seconds in the current minute of your system. e.g. If system time is 15:23:15, then you are trying to get 15. Is that what you're trying to do? If so, you need to check out the GregorianCalendar class
Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"
Here are two possible ways of getting the seconds in the current minute. Use Calendar, eg: Calendar calendar = Calendar.getInstance(); System.out.println("Seconds in current minute = " + calendar.get(Calendar.SECOND)); Or, use SimpleDateFormat: SimpleDateFormat formatter = new SimpleDateFormat("ss"); System.out.println("Seconds in current minute = " + formatter.format(new Date()));
- Dave
Time flies like an arrow. Fruit flies like a banana. Steve flies like a tiny ad:
a bit of art, as a gift, the permaculture playing cards