This discussion is archived
1 2 Previous Next 22 Replies Latest reply: Jul 24, 2009 7:04 AM by 3004 Go to original post RSS
  • 15. Re: Mysterious 7 hours in java.text.SimpleDateFormat
    843789 Newbie
    Currently Being Moderated
    "You can lead a horse to water but you can't make him drink."

    ~
  • 16. Re: Mysterious 7 hours in java.text.SimpleDateFormat
    843789 Newbie
    Currently Being Moderated
    BinaryBurnout wrote:
    Interesting thought, but unfortunately I am GMT -5 (EST). So what about the remaining 2 hours?

    Is there a better/propper way to use Date objects to measure an elapsed time? Even if so, since I am not Mountain Central Time (GMT -7) or from South East Asia or Russia (GMT +7), why is the same difference coming up when I utilize the long primitives instead of Date objects?
    As has already been said you should not use Dates as durations, it doesn't really work.

    As to the 7 hours, it is not 7 hours it is 5. If you change your time format to either include AM/PM or use 24 hour notation you will see that your 07:00:05.001 is really 19:00:05.001 on 31-Dec-1969
  • 17. Re: Mysterious 7 hours in java.text.SimpleDateFormat
    3004 Newbie
    Currently Being Moderated
    ColinAtWork wrote:
    Herko_ter_Horst wrote:
    That doesn't work.
    It does work. ;-)
    Nope. The result is meaningless. It's an instant in time. I wouldn't call that "working."
    Remember the original question was about elapsed time.
    Yup. Which Date sucks at representing.
  • 18. Re: Mysterious 7 hours in java.text.SimpleDateFormat
    3004 Newbie
    Currently Being Moderated
    yawmark wrote:
    ColinAtWork wrote:
    Remember the original question was about elapsed time.
    Which is why your code is broken. The java.util.Date class models a point in time, not elapsed time. There is no class in the core Java API that models elapsed time. Consider using something like Joda, which does have classes that represent elapsed time.

    ~
    Maybe if we get enough of us to say it, and then one little Who to "Yop!" the message will finally get through. :-)
  • 19. Re: Mysterious 7 hours in java.text.SimpleDateFormat
    3004 Newbie
    Currently Being Moderated
    johndjr wrote:
    BinaryBurnout wrote:
    Interesting thought, but unfortunately I am GMT -5 (EST). So what about the remaining 2 hours?

    Is there a better/propper way to use Date objects to measure an elapsed time? Even if so, since I am not Mountain Central Time (GMT -7) or from South East Asia or Russia (GMT +7), why is the same difference coming up when I utilize the long primitives instead of Date objects?
    As has already been said you should not use Dates as durations, it doesn't really work.

    As to the 7 hours, it is not 7 hours it is 5. If you change your time format to either include AM/PM or use 24 hour notation you will see that your 07:00:05.001 is really 19:00:05.001 on 31-Dec-1969
    ...which brings us right back to reply 1
    blah blah misundertanding TZ, blah blah, don't use Date as duration, blah blah at GMT +/- 7 I'll bet.
    ...except s/7/5, and then a couple of replies later, the OP states he's at GMT-5, so TA-DA!
  • 20. Re: Mysterious 7 hours in java.text.SimpleDateFormat
    YoungWinston Expert
    Currently Being Moderated
    BinaryBurnout wrote:
    Interesting thought, but unfortunately I am GMT -5 (EST).
    You must be on a reaaally old machine. Mine actually works out that we're on summer time now.

    Winston
  • 21. Re: Mysterious 7 hours in java.text.SimpleDateFormat
    3004 Newbie
    Currently Being Moderated
    YoungWinston wrote:
    BinaryBurnout wrote:
    Interesting thought, but unfortunately I am GMT -5 (EST).
    You must be on a reaaally old machine. Mine actually works out that we're on summer time now.

    Winston
    There are parts of IN and either AZ or NM that don't go to DST. Perhaps there are similar regions in the Eastern TZ? Or maybe he's just like a lot of people and doesn't get that EST becomes EDT for more than half the year.
1 2 Previous Next