Discussions

EJB programming & troubleshooting: Problem when computing time difference when daylightTime changes

  1. Time in: 10:00 p.m. on 03/10/2007 at CST Time out: 05:00 a.m. on 03/11/2007 at CDT - because daylight start in 2007 on this date Hours worked differnce is comming 7 hours. Acaually it should be 6 hours, since at 2 a.m. on 03/11/2007 time changes to 1 a.m.. This problem is also when vice versa (when daylight time changes back to non-daylight savings) I mean the difference is 7 hours, but actually it should be 8 hours. Any help?????
  2. You must use the underlying millisecond (Date.getTime()) representation to evaluate true elapsed time. Then re-work the millisecond time difference into hours and minutes. /Niklas
  3. It worked. Many thanks.