This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
You probably think it's odd because it returns the number of milliseconds since the epoch. From the api:
the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.
Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"
Joined: Sep 13, 2002
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
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()));