Humans like to measure time in variety of units including nanoseconds, microseconds, seconds, hours, days, weeks, months, years and centuries. For computation it is best to convert your times and time durations to a common unit, do your calculations, then convert back into whatever units the user likes. The most common units to work with are the millisecond used by System.currentTimeMillis, Date, Calendar and days used by BigDate. You can roll your own conversions or you can use java.util.concurrent.TimeUnit that came in with Java version 1.5. Here are the various conversion factors you will need, both created from scratch and via TimeUnit.
TimeUnit always rounds down when converting units.
TimeUnit is available in Java 1.5+. Prior to that you will have to roll your own conversion constants.
This page is posted
Optional Replicator mirror
|no blog for this page||Canadian
Your face IP:[220.127.116.11]
You are visitor number|