Probably a beginner question *mutters* but I thought I would CONSIDER putting it here, just for you Cindy Anyway, I have the following code:
And I get the following output: Time: 90000 OFF: 0 TZ: Greenwich Mean Time 17:01:30 I'm in the MST time zone, which is why I'm getting that 17, instead of 00. My question is, WHY!?! If it is showing that the Calendar instance I'm using has on offset of 0, is using GMT time zone, then shouldn't I be returning 00:01:30? What I'm trying to do is given a delta time in milliseconds, print out the number of hours, minutes and seconds of that delta time in a specified format. I could easily write out the computation to get all that, but would be nice if I could use a Calendar and formatter. Thanks!
Since the quote below points out that SimpleDateFormat has it's own Calendar object, and that is using the default time zone of your PC, I expect that is what you are seeing instead of the time zone of YOUR calendar object.
Workaround If you are converting a Calendar object from your timezone to GMT: begin.add(Calendar.MILLISECOND, (-1) * begin.get(begin.ZONE_OFFSET));
Evaluation GregorianCalendar keeps local time consistent at each GMT offset. (Note that SimpleDateFormat has its own Calendar object that has the default TimeZone.)