2 Replies Latest reply: Dec 20, 2012 6:37 PM by jschellSomeoneStoleMyAlias RSS

    How to convert date formats from one timezone to another

    958133
      Hi All,
      I want to write a java code for converting date formats from one timezone to another with daylight.
      Any Thoughts?
        • 1. Re: How to convert date formats from one timezone to another
          gimbal2
          Tip: a (programming) question consisting of one sentence is never ever a question that can be answered. It simply does not contain enough information.

          In this case: what exactly is a "date format"? Some random string somewhere?
          • 2. Re: How to convert date formats from one timezone to another
            jschellSomeoneStoleMyAlias
            955130 wrote:
            Any Thoughts?
            java.util.Date is ALWAYS utc.

            The only 'timezone' in relation to that is how you create/parse data from other sources.

            Normally one uses SimpleDateFormat to facilitate that.
            There are other methods such as jdbc drivers which are used to create/output from a database.

            Timestamps always have an implicit or explicit timezone associated with it. If you have a data source of a timestamp (date/time) such as text which does not have an explicit timezone then you MUST determine what the timezone is. Doing that might involve asking/insisting that the source provide the information either with the text or provide written documentation stating what the timezone is.