title: Simple date class in Java
body: <p>Is there a date class in Java which I can construct with a year, month, day, hour, minute, second and millisecond and then do comparisons which give the number of milliseonds between two date values, ignoring things like daylight saving, leap seconds etc? Can I use the Calendar class for this? I was thinking about doing that, but it talks about leap seconds and daylight saving, and I don't want that to affect the calculations.</p>
  
  <p>It is important that the following invariant holds true all the times:</p>
  
  <p>For all y1, y2, m1, m2, d1, d2, h, m, s, ms:</p>
  
  <pre><code>(
      f(y1, m1, d1, h, m, s, ms).getTimeInMillis() - 
      f(y2, m2, d2, h, m, s, ms).getTimeInMillis()
  ) 
  % 
  (24 * 60 * 60 * 1000) == 0
  </code></pre>
  
  <p>I basically need to know what the function f should be.</p>