Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How To Read Local Machine Time

How To Read Local Machine Time

Scheduled Pinned Locked Moved Visual Basic
csharpasp-nettutorial
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    ktomecek
    wrote on last edited by
    #1

    I am developing in VS2008 Express Edition using ASP.net and VB.net. I would like to record the local time when something happens in the application (say a button is pressed). If you use the Now() function, it returns the Servers time. I want the time on the local computer. I have searched high and low and am baffled this is not needed more often. There is practically no mention of it on the web. Any pointers would be appreciated. Thanks, Karl Tomecek

    D P K 3 Replies Last reply
    0
    • K ktomecek

      I am developing in VS2008 Express Edition using ASP.net and VB.net. I would like to record the local time when something happens in the application (say a button is pressed). If you use the Now() function, it returns the Servers time. I want the time on the local computer. I have searched high and low and am baffled this is not needed more often. There is practically no mention of it on the web. Any pointers would be appreciated. Thanks, Karl Tomecek

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      This question really belongs in the ASP.NET forum. It has nothing to do with VB.NET at all. There is nothing that the browser sends to your ASP.NET code that will tell you what timezone the client is in. You'll probably have to use JavaScript code in the page to set a hidden field with the clients time when the form is submitted back to your server to get the client time, or at least the timezone the client is in. Your ASP.NET code would then have to parse the date time value found in the hidden field to get at this information.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      M 1 Reply Last reply
      0
      • K ktomecek

        I am developing in VS2008 Express Edition using ASP.net and VB.net. I would like to record the local time when something happens in the application (say a button is pressed). If you use the Now() function, it returns the Servers time. I want the time on the local computer. I have searched high and low and am baffled this is not needed more often. There is practically no mention of it on the web. Any pointers would be appreciated. Thanks, Karl Tomecek

        P Offline
        P Offline
        Parwej Ahamad
        wrote on last edited by
        #3

        I think it would be possible via the Javascript. First get the time via jscript and then submit the form.

        Parwej Ahamad R & D with IIS 5.0/6.0

        1 Reply Last reply
        0
        • D Dave Kreskowiak

          This question really belongs in the ASP.NET forum. It has nothing to do with VB.NET at all. There is nothing that the browser sends to your ASP.NET code that will tell you what timezone the client is in. You'll probably have to use JavaScript code in the page to set a hidden field with the clients time when the form is submitted back to your server to get the client time, or at least the timezone the client is in. Your ASP.NET code would then have to parse the date time value found in the hidden field to get at this information.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008

          M Offline
          M Offline
          Mycroft Holmes
          wrote on last edited by
          #4

          I beleive it is available in the environment variables which can be got at via JS

          Never underestimate the power of human stupidity RAH

          D 1 Reply Last reply
          0
          • M Mycroft Holmes

            I beleive it is available in the environment variables which can be got at via JS

            Never underestimate the power of human stupidity RAH

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            Does that also apply to JavaScript running in a browser on a *nix box??

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008

            M 1 Reply Last reply
            0
            • D Dave Kreskowiak

              Does that also apply to JavaScript running in a browser on a *nix box??

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007, 2008

              M Offline
              M Offline
              Mycroft Holmes
              wrote on last edited by
              #6

              I see what you mean, I may be thinking of the win env vars. Is there a equivalent to the var set in *nix is probably the relevant ?

              Never underestimate the power of human stupidity RAH

              1 Reply Last reply
              0
              • K ktomecek

                I am developing in VS2008 Express Edition using ASP.net and VB.net. I would like to record the local time when something happens in the application (say a button is pressed). If you use the Now() function, it returns the Servers time. I want the time on the local computer. I have searched high and low and am baffled this is not needed more often. There is practically no mention of it on the web. Any pointers would be appreciated. Thanks, Karl Tomecek

                K Offline
                K Offline
                ktomecek
                wrote on last edited by
                #7

                Thanks for all your input. It helped me find a great website with a video that more or less shows you how to do this. In the end, it was done with Javascript storing the date in a hidden variable and then the app has access to that data. Here is the link in case anyone ever needs to learn how to do this: http://www.asp.net/learn/videos/video-275.aspx Thanks to you all once again... Regards, Karl

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups