help required in converting GMT time to local time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deepeshn
    New Member
    • May 2006
    • 2

    help required in converting GMT time to local time

    Hi people,

    I have a function which will receive 2 parameters:the date field in GMT time and the user's time zone.

    I have to return a datetime field in the user's time.
    the thing is the server records the GMT time and that is put into the database.
    but when reports are to be generated for a user who doesn't belong to the GMT time zone, for eg say INDIA, then i want the time to be shown as of India's time zone rather than GMT time zone.

    Anxiously awaiting replies.


    Regards,
    Deepesh
  • arbert
    New Member
    • May 2006
    • 6

    #2
    What database and what front-end language.

    Comment

    • deepeshn
      New Member
      • May 2006
      • 2

      #3
      The database is sql server 2000. And the programming language is java.
      The thing is I have solved the initial problem. but now the problem is to take care of day light saving.
      The 2 paramaters bring passed are: the datetime value and the time_zone like GMT-6:00.
      this second field will determine how much from the GMT have i got to substract to get the local time. I have hard-coded such comparisons becoz there is a fixed number of values that will be passed. Though its not a good method this was the best i could think of then.
      Now the problem comes with daylight saving. Now for eg. GMT-6:00 corresponds to Central Time for Us and canada. So how do i take care of daylight here.

      Regards,
      Deepesh

      Comment

      • arbert
        New Member
        • May 2006
        • 6

        #4
        And what about the states that don't observer DST?????

        I think you would be best to look at the Calendar class (and getTimeZone). Since I assume your clients will be in different timezones, you would have to rely on the time coming from the client and passing that to SQL:



        Brett
        Perfect Computing, Inc

        Comment

        Working...