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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. System date problem

System date problem

Scheduled Pinned Locked Moved C#
databasehelpcsharpsysadmin
5 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.
  • H Offline
    H Offline
    Harikrk
    wrote on last edited by
    #1

    I am using windows xp as my OS. set the system time format as US format. I have developed an application in c# with msssql server as back end. When i change my system date format as UK format (dd/mm/yyy) i am getting the application crashed. The error is comming in the sql query to insert into db. It shows the date is overflow. Can anyone figure out the issue regards hari aspspider.net/rkharikrishnan

    N L 2 Replies Last reply
    0
    • H Harikrk

      I am using windows xp as my OS. set the system time format as US format. I have developed an application in c# with msssql server as back end. When i change my system date format as UK format (dd/mm/yyy) i am getting the application crashed. The error is comming in the sql query to insert into db. It shows the date is overflow. Can anyone figure out the issue regards hari aspspider.net/rkharikrishnan

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Are you storing the date in a neutral format such as UTC?


      only two letters away from being an asset

      1 Reply Last reply
      0
      • H Harikrk

        I am using windows xp as my OS. set the system time format as US format. I have developed an application in c# with msssql server as back end. When i change my system date format as UK format (dd/mm/yyy) i am getting the application crashed. The error is comming in the sql query to insert into db. It shows the date is overflow. Can anyone figure out the issue regards hari aspspider.net/rkharikrishnan

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        Yep, date formats are a popular reason for failure. What is 01/02/03 supposed to mean if you are not sure which date format is used ? And which of 28/02/03 and 01/31/03 does not exist (and will cause a Parse exception) ? So best is to use a universal format (such as UTC), independent of what will be input/output to the users. :)

        Luc Pattyn

        H 1 Reply Last reply
        0
        • L Luc Pattyn

          Yep, date formats are a popular reason for failure. What is 01/02/03 supposed to mean if you are not sure which date format is used ? And which of 28/02/03 and 01/31/03 does not exist (and will cause a Parse exception) ? So best is to use a universal format (such as UTC), independent of what will be input/output to the users. :)

          Luc Pattyn

          H Offline
          H Offline
          Harikrk
          wrote on last edited by
          #4

          thanks for teh reply. can you tell me how i can use UTC format. I am having datetime pickers in my form and also i have to use current date

          L 1 Reply Last reply
          0
          • H Harikrk

            thanks for teh reply. can you tell me how i can use UTC format. I am having datetime pickers in my form and also i have to use current date

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            Hi, there are actually two issues: - time zones: if you want to be able to exchange files that contain time info around the world, the app must understand how to handle differences in time zone. That is what UTC offers a good solution for (see some of the DateTime methods). - formats: if you want your app to understand date/time strings in a file, you can not rely on the system's datetime format during parsing to correspond with the one used during writing that info (on same or other machine, by same or other user, with regional settings maybe changed, etc). There are some articles dealing with these issues here on CP, try a search. A found at least one that seems relevant.[^] :)

            Luc Pattyn

            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