Getting client computers local time

Discussion in 'ASP .Net' started by Andy B, Dec 17, 2008.

  1. Andy B

    Andy B Guest

    How do you show the client computers local time on a page even if the page
    is hosted in a totally different timezone?
     
    Andy B, Dec 17, 2008
    #1
    1. Advertising

  2. On Dec 17, 8:56 pm, "Andy B" <> wrote:
    > How do you show the client computers local time on a page even if the page
    > is hosted in a totally different timezone?


    using client (java)script

    <script type="text/javascript">
    var t= new Date();
    alert(t);
    </script>
     
    Alexey Smirnov, Dec 17, 2008
    #2
    1. Advertising

  3. Andy,

    Just place a javascript on the page in the location you want to show the
    time. Javascript runs on the local machine and therefore will display the
    local time.

    Here's a quick .net sample:
    http://weblogs.asp.net/farazshahkhan/archive/2008/02/13/javascript-to-display-time-on-web-page.aspx


    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche




    "Andy B" <> wrote in message
    news:%...
    > How do you show the client computers local time on a page even if the page
    > is hosted in a totally different timezone?
    >
     
    S. Justin Gengo, Dec 17, 2008
    #3
  4. Andy B

    Andy B Guest

    Is there a way of doing this so mobile devices can show it?

    "Mark Rae [MVP]" <> wrote in message
    news:...
    > "Andy B" <> wrote in message
    > news:%...
    >
    >> How do you show the client computer's local time on a page even if the
    >> page is hosted in a totally different timezone?

    >
    > <div>
    > <script type="text/javascript">
    > document.write(Date());
    > </script>
    > </div>
    >
    > Google for JavaScript date / time formatting options...
    >
    >
    > --
    > Mark Rae
    > ASP.NET MVP
    > http://www.markrae.net
     
    Andy B, Dec 18, 2008
    #4
  5. On Dec 19, 12:25 am, "Andy B" <> wrote:
    > Is there a way of doing this so mobile devices can show it?
    >
    > "Mark Rae [MVP]" <> wrote in messagenews:...
    >
    > > "Andy B" <> wrote in message
    > >news:%...

    >
    > >> How do you show the client computer's local time on a page even if the
    > >> page is hosted in a totally different timezone?

    >
    > > <div>
    > >    <script type="text/javascript">
    > >        document.write(Date());
    > >    </script>
    > > </div>

    >
    > > Google for JavaScript date / time formatting options...

    >
    > > --
    > > Mark Rae
    > > ASP.NET MVP
    > >http://www.markrae.net


    There are mobiles which do not support JavaScript. You would need to
    prompt user to choose the time zone. Take a look at the following
    thread for more details: http://forums.asp.net/p/1090269/1646091.aspx

    Hope this helps
     
    Alexey Smirnov, Dec 19, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris
    Replies:
    1
    Views:
    348
    Veronica Jacobs
    Jun 1, 2004
  2. Replies:
    1
    Views:
    831
    Paul Boddie
    Mar 11, 2007
  3. Jonathan Wood
    Replies:
    1
    Views:
    2,233
    Jonathan Wood
    Nov 1, 2009
  4. Yaiz

    Making ASMX Test available to non-local computers

    Yaiz, Jan 17, 2005, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    210
    Ollie Riches
    Jan 18, 2005
  5. David Joseph Bonnici
    Replies:
    1
    Views:
    231
    Gunnar Hjalmarsson
    May 15, 2005
Loading...

Share This Page