2 Replies Latest reply: Sep 27, 2007 9:39 AM by DrClap RSS

    Timestamp.getTime() , Date.getTime()

    807605
      Hi,

      Is there a difference between Timestamp.getTime() and Date.getTime(). Are the returning values different for the same date?

      Olek
        • 1. Re: Timestamp.getTime() , Date.getTime()
          807605
          Olek wrote:
          Hi,

          Is there a difference between Timestamp.getTime() and Date.getTime(). Are the returning values different for the same date?

          Olek
          There should be no difference as per the information in the API documentation. Maybe a quick trial with a sample code could tell.
          • 2. Re: Timestamp.getTime() , Date.getTime()
            DrClap
            Let's suppose, since we aren't told this, that you are asking about java.sql.Date and not about java.util.Date.

            You've read the documentation and learned that a Date object doesn't have a time component, correct? And that a Timestamp component does have one?

            If the Timestamp's time component is 00:00:00.000000 then I would expect its getTime() method to return the same as the getTime() method of a Date object with the same date component. However without doing a test, I don't know whether timezones might be a complicating factor here.

            Do you have a specific question? Theoretical questions are generally a waste of time both for the questioner and the answerer.