ASP time in GMT

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

    ASP time in GMT

    Hello,

    I've used this ASP funtion to display the time on my web page:

    Date: <%= FormatDateTime( Date, 1)%>
    Time: <%= FormatDateTime( now, 4)%>

    THis was working fine until i moved my site to a server based in the states,
    not the time is 5hrs behind. Can anyone help me resolve this??

    Many thanks.

    Abs


  • Evertjan.

    #2
    Re: ASP time in GMT

    Abs wrote on 13 mrt 2007 in microsoft.publi c.inetserver.as p.general:
    Hello,
    >
    I've used this ASP funtion to display the time on my web page:
    >
    Date: <%= FormatDateTime( Date, 1)%>
    Time: <%= FormatDateTime( now, 4)%>
    >
    THis was working fine until i moved my site to a server based in the
    states, not the time is 5hrs behind. Can anyone help me resolve
    this??
    It would be usefull if you told us your timezone!

    This topic was posted by me yesterday in his NG,

    The server being in Toronto [Now],
    the result in Central European Time [nowCET].
    =============== =============== ====
    <%
    nowGMT = DateAdd("h", TimezoneOffset, Now)
    nowCET = DateAdd("h", 1, nowGMT)
    If nowGMT>#2007-03-25 01:00# Then nowCET = DateAdd("h",2,n owGMT)
    If nowGMT>#2007-10-28 01:00# Then nowCET = DateAdd("h",1,n owGMT)
    If nowGMT>#2008-03-30 01:00# Then nowCET = DateAdd("h",2,n owGMT)
    If nowGMT>#2008-10-26 01:00# Then nowCET = DateAdd("h",1,n owGMT)
    %>
    >
    <script language='javas cript' runat='server'>
    var TimezoneOffset = new Date().getTimez oneOffset()/60;
    </script>
    =============== =============== =============
    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)

    Comment

    • MikeR

      #3
      Re: ASP time in GMT

      Abs wrote:
      Hello,
      >
      I've used this ASP funtion to display the time on my web page:
      >
      Date: <%= FormatDateTime( Date, 1)%>
      Time: <%= FormatDateTime( now, 4)%>
      >
      THis was working fine until i moved my site to a server based in the states,
      not the time is 5hrs behind. Can anyone help me resolve this??
      >
      Many thanks.
      >
      Abs
      >
      >

      Mike

      Comment

      • Jon Paal [MSMD]

        #4
        Re: ASP time in GMT

        ASP runs on the server and will return server time. If you want local time of the user to be displayed on the page you can use
        client side javascript .





        "Abs" <noemailrtses@e mail.comwrote in message news:%23weF4rbZ HHA.4616@TK2MSF TNGP03.phx.gbl. ..
        Hello,
        >
        I've used this ASP funtion to display the time on my web page:
        >
        Date: <%= FormatDateTime( Date, 1)%>
        Time: <%= FormatDateTime( now, 4)%>
        >
        THis was working fine until i moved my site to a server based in the states, not the time is 5hrs behind. Can anyone help me
        resolve this??
        >
        Many thanks.
        >
        Abs
        >

        Comment

        • Evertjan.

          #5
          Re: ASP time in GMT

          Jon Paal [MSMD] wrote on 14 mrt 2007 in
          microsoft.publi c.inetserver.as p.general:
          "Abs" <noemailrtses@e mail.comwrote in message
          >THis was working fine until i moved my site to a server based in the
          >states, not the time is 5hrs behind. Can anyone help me resolve
          >this??
          [Please do not toppost on usenet]
          ASP runs on the server and will return server time. If you want local
          time of the user to be displayed on the page you can use client side
          javascript .
          However, it is quite possible to add
          trusted [ ;-) ] serverside time precision to that:

          =============== ===========
          <script runat=server language=javasc ript>
          var ds = new Date();
          ds = ds*1;
          </script>

          <script type='text/javascript'>

          var ds = <% =ds %>; // numerical UTC server
          var dc = new Date();
          dc = dc*1; // numerical UTC client
          var dif = ds-dc; // millisecs UTC difference
          dif2 = Math.floor(-dif/1000)

          document.write( "Local clock error: " + dif2 + " sec.<br><br>");

          d = new Date()

          document.write( "Client time being: " + d + "<br><br>") ;

          d = new Date(d*1+dif);

          document.write( "Exact local time being: " + d );

          </script>
          =============== =============

          --
          Evertjan.
          The Netherlands.
          (Please change the x'es to dots in my emailaddress)

          Comment

          • Abs

            #6
            Re: ASP time in GMT

            Thanks guys, probably use javascript.

            "Evertjan." <exjxw.hannivoo rt@interxnl.net wrote in message
            news:Xns98F368E B62992eejj99@19 4.109.133.242.. .
            Jon Paal [MSMD] wrote on 14 mrt 2007 in
            microsoft.publi c.inetserver.as p.general:
            >
            >"Abs" <noemailrtses@e mail.comwrote in message
            >>THis was working fine until i moved my site to a server based in the
            >>states, not the time is 5hrs behind. Can anyone help me resolve
            >>this??
            >
            [Please do not toppost on usenet]
            >
            >ASP runs on the server and will return server time. If you want local
            >time of the user to be displayed on the page you can use client side
            >javascript .
            >
            However, it is quite possible to add
            trusted [ ;-) ] serverside time precision to that:
            >
            =============== ===========
            <script runat=server language=javasc ript>
            var ds = new Date();
            ds = ds*1;
            </script>
            >
            <script type='text/javascript'>
            >
            var ds = <% =ds %>; // numerical UTC server
            var dc = new Date();
            dc = dc*1; // numerical UTC client
            var dif = ds-dc; // millisecs UTC difference
            dif2 = Math.floor(-dif/1000)
            >
            document.write( "Local clock error: " + dif2 + " sec.<br><br>");
            >
            d = new Date()
            >
            document.write( "Client time being: " + d + "<br><br>") ;
            >
            d = new Date(d*1+dif);
            >
            document.write( "Exact local time being: " + d );
            >
            </script>
            =============== =============
            >
            --
            Evertjan.
            The Netherlands.
            (Please change the x'es to dots in my emailaddress)

            Comment

            Working...