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. Web Development
  3. ASP.NET
  4. Current date

Current date

Scheduled Pinned Locked Moved ASP.NET
helptutorialcsharpasp-netdatabase
11 Posts 3 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.
  • O Offline
    O Offline
    Otekpo Emmanuel
    wrote on last edited by
    #1

    Hello friends, I need your help in this issue. Am working on exam system using asp.net. There is a feature I would like to apply. On the onload event of the welcome page, the application should check the devices' date and compare it with the current date. If the devices' date is not same as current date, the person should be redirected to a warning page with a warning message the device date is not accurate. Please set time and date. Example, if the current date is 10-09-2014 and the devices' date is 09-09-2014, that means the devices' date is not accurate. I really need this because the date and time student logged in will be auto-captured and saved to database for officials' use. I have googled alot but couldn't found any match and am not even sure if am using the right keywords. Please, any idea on how to play around this will be highly appreciated.

    A 1 Reply Last reply
    0
    • O Otekpo Emmanuel

      Hello friends, I need your help in this issue. Am working on exam system using asp.net. There is a feature I would like to apply. On the onload event of the welcome page, the application should check the devices' date and compare it with the current date. If the devices' date is not same as current date, the person should be redirected to a warning page with a warning message the device date is not accurate. Please set time and date. Example, if the current date is 10-09-2014 and the devices' date is 09-09-2014, that means the devices' date is not accurate. I really need this because the date and time student logged in will be auto-captured and saved to database for officials' use. I have googled alot but couldn't found any match and am not even sure if am using the right keywords. Please, any idea on how to play around this will be highly appreciated.

      A Offline
      A Offline
      Ali Al Omairi Abu AlHassan
      wrote on last edited by
      #2

      I think that you should not use the client date instead use your server date on student login so you would face no problem as the server date appears on the screen.

      Help people,so poeple can help you.

      O 1 Reply Last reply
      0
      • A Ali Al Omairi Abu AlHassan

        I think that you should not use the client date instead use your server date on student login so you would face no problem as the server date appears on the screen.

        Help people,so poeple can help you.

        O Offline
        O Offline
        Otekpo Emmanuel
        wrote on last edited by
        #3

        Thanks. But, how can I capture the server date?

        A 1 Reply Last reply
        0
        • O Otekpo Emmanuel

          Thanks. But, how can I capture the server date?

          A Offline
          A Offline
          Ali Al Omairi Abu AlHassan
          wrote on last edited by
          #4

          easily. When a student logged in you save getdate() which would return the database time. or you pass the value of DateTime.Now for the web server time. and you can do the same for the time you want to send it with the response.

          Help people,so poeple can help you.

          O 1 Reply Last reply
          0
          • A Ali Al Omairi Abu AlHassan

            easily. When a student logged in you save getdate() which would return the database time. or you pass the value of DateTime.Now for the web server time. and you can do the same for the time you want to send it with the response.

            Help people,so poeple can help you.

            O Offline
            O Offline
            Otekpo Emmanuel
            wrote on last edited by
            #5

            Thanks I really appreciate your response. But, when if I use DateTime.Now, is the client device date that will be captured and the date might not be current. This is what am trying to avoid. To be more specific, assuming today's date now which is 11/09/2014 and maybe the student might not have his device date set(assuming the students' device date is 10/08/2014 instead of 11/09/2014, I want to compare the current date with the device date then if match, student should be allowed else should be prompt for system date correction. Anyway? Please.

            Richard DeemingR 1 Reply Last reply
            0
            • O Otekpo Emmanuel

              Thanks I really appreciate your response. But, when if I use DateTime.Now, is the client device date that will be captured and the date might not be current. This is what am trying to avoid. To be more specific, assuming today's date now which is 11/09/2014 and maybe the student might not have his device date set(assuming the students' device date is 10/08/2014 instead of 11/09/2014, I want to compare the current date with the device date then if match, student should be allowed else should be prompt for system date correction. Anyway? Please.

              Richard DeemingR Offline
              Richard DeemingR Offline
              Richard Deeming
              wrote on last edited by
              #6

              Calling DateTime.Now from server-side code will capture the current date and time on the server. The client's date/time settings will have no effect.


              "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

              "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

              O 1 Reply Last reply
              0
              • Richard DeemingR Richard Deeming

                Calling DateTime.Now from server-side code will capture the current date and time on the server. The client's date/time settings will have no effect.


                "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                O Offline
                O Offline
                Otekpo Emmanuel
                wrote on last edited by
                #7

                Ok. Thanks. But, please how can I call the DateTime.Now on the server side?

                Richard DeemingR 1 Reply Last reply
                0
                • O Otekpo Emmanuel

                  Ok. Thanks. But, please how can I call the DateTime.Now on the server side?

                  Richard DeemingR Offline
                  Richard DeemingR Offline
                  Richard Deeming
                  wrote on last edited by
                  #8

                  Just add it to the code that's saving the details to the database:

                  yourInsertCommand.Parameters.AddWithValue("@StartDate", DateTime.Now);


                  "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                  "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                  O 2 Replies Last reply
                  0
                  • Richard DeemingR Richard Deeming

                    Just add it to the code that's saving the details to the database:

                    yourInsertCommand.Parameters.AddWithValue("@StartDate", DateTime.Now);


                    "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                    O Offline
                    O Offline
                    Otekpo Emmanuel
                    wrote on last edited by
                    #9

                    I reset my systems' date to incorrect date and tried what you suggested. But, it was the system's date which is inaccurate it captured. Or will this before solve when the site has been host?

                    Richard DeemingR 1 Reply Last reply
                    0
                    • Richard DeemingR Richard Deeming

                      Just add it to the code that's saving the details to the database:

                      yourInsertCommand.Parameters.AddWithValue("@StartDate", DateTime.Now);


                      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                      O Offline
                      O Offline
                      Otekpo Emmanuel
                      wrote on last edited by
                      #10

                      I reset my systems' date to incorrect date and tried what you suggested. But, it was the system's date which is inaccurate it captured. Or will this be solve when the site has been host?

                      1 Reply Last reply
                      0
                      • O Otekpo Emmanuel

                        I reset my systems' date to incorrect date and tried what you suggested. But, it was the system's date which is inaccurate it captured. Or will this before solve when the site has been host?

                        Richard DeemingR Offline
                        Richard DeemingR Offline
                        Richard Deeming
                        wrote on last edited by
                        #11

                        If you're testing the site locally, the client and server will be the same machine. If you change the client's date, then you're also changing the server's date.


                        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                        "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                        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