Time zones: Pretending to be somewhere else

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nathan Sokalski

    Time zones: Pretending to be somewhere else

    I use a webhosting service that is something like halfway around the world
    from me and most of the people that will be viewing my site (and I am
    assuming their server is too). This obviously has very little effect on what
    I can do, but there is one thing that I would like to know how to do (if it
    can be done). When I do something that involves getting the current date or
    time, my application gets it from the server it is running on, which means
    it could be off by as much about half a day, and many of my pages preselect
    the current date for certain things, but sometimes that is incorrect for the
    same reason. Is there any way to make my entire application automatically
    adjust these values to the timezone I am in (is there a way I can put a
    setting in the web.config or Global.asax.vb file or something that says
    "where I am" so it adjusts these values based on where the server says it
    is)? This would make things much less complicated for me, as well as make it
    easier if I ever have to move my application to a different webhost or
    server. Thanks.
    --
    Nathan Sokalski
    njsokalski@hotm ail.com
    有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。



  • EJD

    #2
    Re: Time zones: Pretending to be somewhere else

    Nathan,

    You may want to check out either the locally installed .net help or
    this article - they're basically the same thing. I think it'll help...



    Eric David

    Comment

    • Nathan Sokalski

      #3
      Re: Time zones: Pretending to be somewhere else

      That may be useful in doing specific situations, but I was looking for
      something more centralized, something where I wouldn't need to add the code
      for every situation involving a datetime variable (that would involve a lot
      of extra code). Any other thoughts?
      --
      Nathan Sokalski
      njsokalski@hotm ail.com
      有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。


      "EJD" <jpfoonja@hotma il.com> wrote in message
      news:1137815741 .018152.211360@ g14g2000cwa.goo glegroups.com.. .[color=blue]
      > Nathan,
      >
      > You may want to check out either the locally installed .net help or
      > this article - they're basically the same thing. I think it'll help...
      >
      > http://msdn2.microsoft.com/en-us/library/5hh873ya.aspx
      >
      > Eric David
      >[/color]


      Comment

      • EJD

        #4
        Re: Time zones: Pretending to be somewhere else

        I'm not 100% sure but I don't think that you can accurately display the
        local date on a client's machine without writing some "extra" code.
        The server has no idea what time it is where the client is located
        unless you tell it to find out what the local time is on the client
        machine, and then compare it to the server's own time. Maybe this
        could make life easier... but it would require writing some more code.


        Unless someone else knows of a better way... Good luck.
        Eric

        Comment

        • William \(Bill\) Vaughn

          #5
          Re: Time zones: Pretending to be somewhere else

          We don't use local time for situations like this. We use GMT. This way it's
          always the same world-wide. Once captured we can query the local system for
          its current timezone and adjust--but only if the user has to see this value
          and it must be shown in the local timezone.

          --
          _______________ _______________ ______
          William (Bill) Vaughn
          Author, Mentor, Consultant
          Microsoft MVP
          INETA Speaker
          Welcome to the home of William Vaughn's Imagination, creations, and advice.

          Welcome to the home of William Vaughn's Imagination, creations, and advice.

          Please reply only to the newsgroup so that others can benefit.
          This posting is provided "AS IS" with no warranties, and confers no rights.
          _______________ _______________ ____

          "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
          news:%23ZNBJujH GHA.2696@TK2MSF TNGP14.phx.gbl. ..[color=blue]
          >I use a webhosting service that is something like halfway around the world
          >from me and most of the people that will be viewing my site (and I am
          >assuming their server is too). This obviously has very little effect on
          >what I can do, but there is one thing that I would like to know how to do
          >(if it can be done). When I do something that involves getting the current
          >date or time, my application gets it from the server it is running on,
          >which means it could be off by as much about half a day, and many of my
          >pages preselect the current date for certain things, but sometimes that is
          >incorrect for the same reason. Is there any way to make my entire
          >application automatically adjust these values to the timezone I am in (is
          >there a way I can put a setting in the web.config or Global.asax.vb file or
          >something that says "where I am" so it adjusts these values based on where
          >the server says it is)? This would make things much less complicated for
          >me, as well as make it easier if I ever have to move my application to a
          >different webhost or server. Thanks.
          > --
          > Nathan Sokalski
          > njsokalski@hotm ail.com
          > http://www.nathansokalski.com/
          >[/color]


          Comment

          • clintonG

            #6
            Re: Time zones: Pretending to be somewhere else

            This really aggravates the hell out of me. My server is (-06:00 GMT) and the
            2.0 Website Administration Tool for example and other 2.0 controls write
            database entries offset 6 hours into the future. So William, when you mean
            "adjust" you must mean the database administrator or the web developer must
            "adjust" to the fact that they are now compelled to write compensation code
            that somehow captures the date and time of the user and applies an offset to
            accurately record date and time circumstantiall y.

            The flaw in this reasoning, and correct me if I'm wrong, is the fact that
            the framework does not record which time zone a user is in when it
            automatically records the date and time using "adjusted" GMT values which
            requires the use of an offset. So how is the database administrator or the
            developer supposed to know what offset value to use when they need to work
            with the date and time values at some point in the future?

            As far as I've been able to determine the answer is "they don't." This
            decision by some Microsoft crackhead to force everybody to record data using
            GMT was not thought out well and as usual implemented as crippleware.

            If we are going to be forced to adopt GMT at least the offset value should
            be recorded into the database when the framework uses brute force to record
            the GMT value.

            <%= Clinton Gallagher
            METROmilwaukee (sm) "A Regional Information Service"
            NET csgallagher AT metromilwaukee. com
            URL http://metromilwaukee.com/
            URL http://clintongallagher.metromilwaukee.com/



            "William (Bill) Vaughn" <billvaRemoveTh is@nwlink.com> wrote in message
            news:%23O3GhprH GHA.1332@TK2MSF TNGP10.phx.gbl. ..[color=blue]
            > We don't use local time for situations like this. We use GMT. This way
            > it's always the same world-wide. Once captured we can query the local
            > system for its current timezone and adjust--but only if the user has to
            > see this value and it must be shown in the local timezone.
            >
            > --
            > _______________ _______________ ______
            > William (Bill) Vaughn
            > Author, Mentor, Consultant
            > Microsoft MVP
            > INETA Speaker
            > www.betav.com/blog/billva
            > www.betav.com
            > Please reply only to the newsgroup so that others can benefit.
            > This posting is provided "AS IS" with no warranties, and confers no
            > rights.
            > _______________ _______________ ____
            >
            > "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
            > news:%23ZNBJujH GHA.2696@TK2MSF TNGP14.phx.gbl. ..[color=green]
            >>I use a webhosting service that is something like halfway around the world
            >>from me and most of the people that will be viewing my site (and I am
            >>assuming their server is too). This obviously has very little effect on
            >>what I can do, but there is one thing that I would like to know how to do
            >>(if it can be done). When I do something that involves getting the current
            >>date or time, my application gets it from the server it is running on,
            >>which means it could be off by as much about half a day, and many of my
            >>pages preselect the current date for certain things, but sometimes that is
            >>incorrect for the same reason. Is there any way to make my entire
            >>application automatically adjust these values to the timezone I am in (is
            >>there a way I can put a setting in the web.config or Global.asax.vb file
            >>or something that says "where I am" so it adjusts these values based on
            >>where the server says it is)? This would make things much less complicated
            >>for me, as well as make it easier if I ever have to move my application to
            >>a different webhost or server. Thanks.
            >> --
            >> Nathan Sokalski
            >> njsokalski@hotm ail.com
            >> http://www.nathansokalski.com/
            >>[/color]
            >
            >[/color]


            Comment

            • David Wang [Msft]

              #7
              Re: Time zones: Pretending to be somewhere else

              I'm not certain what is the aggravation here.

              The timezone is not relevant information when you work with an "absolute and
              common" time. Translation to local user timezone just need to be done at the
              very beginning and end. If you remember to only use and manipulate GMT time,
              things just work.

              Think about it -- this works no differently than multi-lingual websites. You
              record data in an absolute and common format like Unicode. You translate
              to/from the user's locale right at the beginning and end, but if you do all
              your manipulation in Unicode, the website should be perfectly I18N.

              --
              //David
              IIS

              This posting is provided "AS IS" with no warranties, and confers no rights.
              //

              "clintonG" <csgallagher@RE MOVETHISTEXTmet romilwaukee.com > wrote in message
              news:OfEJuksHGH A.3896@TK2MSFTN GP15.phx.gbl...[color=blue]
              > This really aggravates the hell out of me. My server is (-06:00 GMT) and
              > the 2.0 Website Administration Tool for example and other 2.0 controls
              > write database entries offset 6 hours into the future. So William, when
              > you mean "adjust" you must mean the database administrator or the web
              > developer must "adjust" to the fact that they are now compelled to write
              > compensation code that somehow captures the date and time of the user and
              > applies an offset to accurately record date and time circumstantiall y.
              >
              > The flaw in this reasoning, and correct me if I'm wrong, is the fact that
              > the framework does not record which time zone a user is in when it
              > automatically records the date and time using "adjusted" GMT values which
              > requires the use of an offset. So how is the database administrator or the
              > developer supposed to know what offset value to use when they need to work
              > with the date and time values at some point in the future?
              >
              > As far as I've been able to determine the answer is "they don't." This
              > decision by some Microsoft crackhead to force everybody to record data
              > using GMT was not thought out well and as usual implemented as
              > crippleware.
              >
              > If we are going to be forced to adopt GMT at least the offset value should
              > be recorded into the database when the framework uses brute force to
              > record the GMT value.
              >
              > <%= Clinton Gallagher
              > METROmilwaukee (sm) "A Regional Information Service"
              > NET csgallagher AT metromilwaukee. com
              > URL http://metromilwaukee.com/
              > URL http://clintongallagher.metromilwaukee.com/
              >
              >
              >
              > "William (Bill) Vaughn" <billvaRemoveTh is@nwlink.com> wrote in message
              > news:%23O3GhprH GHA.1332@TK2MSF TNGP10.phx.gbl. ..[color=green]
              >> We don't use local time for situations like this. We use GMT. This way
              >> it's always the same world-wide. Once captured we can query the local
              >> system for its current timezone and adjust--but only if the user has to
              >> see this value and it must be shown in the local timezone.
              >>
              >> --
              >> _______________ _______________ ______
              >> William (Bill) Vaughn
              >> Author, Mentor, Consultant
              >> Microsoft MVP
              >> INETA Speaker
              >> www.betav.com/blog/billva
              >> www.betav.com
              >> Please reply only to the newsgroup so that others can benefit.
              >> This posting is provided "AS IS" with no warranties, and confers no
              >> rights.
              >> _______________ _______________ ____
              >>
              >> "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
              >> news:%23ZNBJujH GHA.2696@TK2MSF TNGP14.phx.gbl. ..[color=darkred]
              >>>I use a webhosting service that is something like halfway around the
              >>>world from me and most of the people that will be viewing my site (and I
              >>>am assuming their server is too). This obviously has very little effect
              >>>on what I can do, but there is one thing that I would like to know how to
              >>>do (if it can be done). When I do something that involves getting the
              >>>current date or time, my application gets it from the server it is
              >>>running on, which means it could be off by as much about half a day, and
              >>>many of my pages preselect the current date for certain things, but
              >>>sometimes that is incorrect for the same reason. Is there any way to make
              >>>my entire application automatically adjust these values to the timezone I
              >>>am in (is there a way I can put a setting in the web.config or
              >>>Global.asax. vb file or something that says "where I am" so it adjusts
              >>>these values based on where the server says it is)? This would make
              >>>things much less complicated for me, as well as make it easier if I ever
              >>>have to move my application to a different webhost or server. Thanks.
              >>> --
              >>> Nathan Sokalski
              >>> njsokalski@hotm ail.com
              >>> http://www.nathansokalski.com/
              >>>[/color]
              >>
              >>[/color]
              >
              >[/color]


              Comment

              • Ken Schaefer

                #8
                Re: Time zones: Pretending to be somewhere else

                Hi Clinton,

                I know you are not the original poster here. And I think you're confusing
                the issue.

                Bill is suggesting that the OP use GMT in his/her app to get around the time
                zone issue. No one is forcing *you* to write anything using GMT, and no one
                is forcing your to write compensation code. When you get the current
                date/time using .NET code, it comes back as the current date/time on the
                server *not* GMT. You do not need to apply an offset.

                There are no "crackheads " at Microsoft, and frankly if you want to make
                inaccurate and meaningless rants, I suggest you do it someplace else instead
                of wasting everyone's time here.

                Cheers
                Ken

                "clintonG" <csgallagher@RE MOVETHISTEXTmet romilwaukee.com > wrote in message
                news:OfEJuksHGH A.3896@TK2MSFTN GP15.phx.gbl...
                : This really aggravates the hell out of me. My server is (-06:00 GMT) and
                the
                : 2.0 Website Administration Tool for example and other 2.0 controls write
                : database entries offset 6 hours into the future. So William, when you mean
                : "adjust" you must mean the database administrator or the web developer
                must
                : "adjust" to the fact that they are now compelled to write compensation
                code
                : that somehow captures the date and time of the user and applies an offset
                to
                : accurately record date and time circumstantiall y.
                :
                : The flaw in this reasoning, and correct me if I'm wrong, is the fact that
                : the framework does not record which time zone a user is in when it
                : automatically records the date and time using "adjusted" GMT values which
                : requires the use of an offset. So how is the database administrator or the
                : developer supposed to know what offset value to use when they need to work
                : with the date and time values at some point in the future?
                :
                : As far as I've been able to determine the answer is "they don't." This
                : decision by some Microsoft crackhead to force everybody to record data
                using
                : GMT was not thought out well and as usual implemented as crippleware.
                :
                : If we are going to be forced to adopt GMT at least the offset value should
                : be recorded into the database when the framework uses brute force to
                record
                : the GMT value.
                :
                : <%= Clinton Gallagher
                : METROmilwaukee (sm) "A Regional Information Service"
                : NET csgallagher AT metromilwaukee. com
                : URL http://metromilwaukee.com/
                : URL http://clintongallagher.metromilwaukee.com/
                :
                :
                :
                : "William (Bill) Vaughn" <billvaRemoveTh is@nwlink.com> wrote in message
                : news:%23O3GhprH GHA.1332@TK2MSF TNGP10.phx.gbl. ..
                : > We don't use local time for situations like this. We use GMT. This way
                : > it's always the same world-wide. Once captured we can query the local
                : > system for its current timezone and adjust--but only if the user has to
                : > see this value and it must be shown in the local timezone.
                : >
                : > --
                : > _______________ _______________ ______
                : > William (Bill) Vaughn
                : > Author, Mentor, Consultant
                : > Microsoft MVP
                : > INETA Speaker
                : > www.betav.com/blog/billva
                : > www.betav.com
                : > Please reply only to the newsgroup so that others can benefit.
                : > This posting is provided "AS IS" with no warranties, and confers no
                : > rights.
                : > _______________ _______________ ____
                : >
                : > "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                : > news:%23ZNBJujH GHA.2696@TK2MSF TNGP14.phx.gbl. ..
                : >>I use a webhosting service that is something like halfway around the
                world
                : >>from me and most of the people that will be viewing my site (and I am
                : >>assuming their server is too). This obviously has very little effect on
                : >>what I can do, but there is one thing that I would like to know how to
                do
                : >>(if it can be done). When I do something that involves getting the
                current
                : >>date or time, my application gets it from the server it is running on,
                : >>which means it could be off by as much about half a day, and many of my
                : >>pages preselect the current date for certain things, but sometimes that
                is
                : >>incorrect for the same reason. Is there any way to make my entire
                : >>application automatically adjust these values to the timezone I am in
                (is
                : >>there a way I can put a setting in the web.config or Global.asax.vb file
                : >>or something that says "where I am" so it adjusts these values based on
                : >>where the server says it is)? This would make things much less
                complicated
                : >>for me, as well as make it easier if I ever have to move my application
                to
                : >>a different webhost or server. Thanks.
                : >> --
                : >> Nathan Sokalski
                : >> njsokalski@hotm ail.com
                : >> http://www.nathansokalski.com/
                : >>
                : >
                : >
                :
                :


                Comment

                • Ken Schaefer

                  #9
                  Re: Time zones: Pretending to be somewhere else

                  Nathan,

                  I may be misunderstandin g your issue here, but are you saying:
                  a) you attempt to get the current date/time using .NET code running on the
                  server
                  b) the date/time you get in (a) above reflects the date/time on the server
                  c) but you yourself (and your browser) are located in a completely different
                  timezone
                  d) as a result of (b) and (c) the date/time on the server doesn't reflect
                  the date/time where you yourself are sitting?

                  The problem here is that the server has no idea where you are, or what
                  timezone you are in. You'd probably need to ask each user what their current
                  timezone is, and then have your code apply an offset to display the time
                  according to the user's current timezone.

                  Cheers
                  Ken


                  "Nathan Sokalski" <njsokalski@hot mail.com> wrote in message
                  news:%23ZNBJujH GHA.2696@TK2MSF TNGP14.phx.gbl. ..
                  :I use a webhosting service that is something like halfway around the world
                  : from me and most of the people that will be viewing my site (and I am
                  : assuming their server is too). This obviously has very little effect on
                  what
                  : I can do, but there is one thing that I would like to know how to do (if
                  it
                  : can be done). When I do something that involves getting the current date
                  or
                  : time, my application gets it from the server it is running on, which means
                  : it could be off by as much about half a day, and many of my pages
                  preselect
                  : the current date for certain things, but sometimes that is incorrect for
                  the
                  : same reason. Is there any way to make my entire application automatically
                  : adjust these values to the timezone I am in (is there a way I can put a
                  : setting in the web.config or Global.asax.vb file or something that says
                  : "where I am" so it adjusts these values based on where the server says it
                  : is)? This would make things much less complicated for me, as well as make
                  it
                  : easier if I ever have to move my application to a different webhost or
                  : server. Thanks.
                  : --
                  : Nathan Sokalski
                  : njsokalski@hotm ail.com
                  : http://www.nathansokalski.com/
                  :
                  :


                  Comment

                  Working...