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. C#
  4. DateTimePicker and Regional Setting

DateTimePicker and Regional Setting

Scheduled Pinned Locked Moved C#
helpdatabasecsharpsql-servervisual-studio
4 Posts 2 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.
  • A Offline
    A Offline
    AesopTurtle
    wrote on last edited by
    #1

    I'm using VS.NET 2005 Beta 2 and SQL Server 2005 Express to store personal information. The problem i'm facing is the MinDate value of a DateTimePicker cannot be set to below '1/1/2296'. My regional setting on my pc is set to Thailand (Thai year system is +543 from formal year format e.g. year 2005 in formal format is 2548 in Thai format). Also my SQL Server Collation is set to Thai. When i add a date info into the database via my app, it always adds 543 to the year value from DateTimePicker (2548 --> 3091). So the value in the database will always be 543 years over. Could anyone please help me out on this issue? KiT

    X 1 Reply Last reply
    0
    • A AesopTurtle

      I'm using VS.NET 2005 Beta 2 and SQL Server 2005 Express to store personal information. The problem i'm facing is the MinDate value of a DateTimePicker cannot be set to below '1/1/2296'. My regional setting on my pc is set to Thailand (Thai year system is +543 from formal year format e.g. year 2005 in formal format is 2548 in Thai format). Also my SQL Server Collation is set to Thai. When i add a date info into the database via my app, it always adds 543 to the year value from DateTimePicker (2548 --> 3091). So the value in the database will always be 543 years over. Could anyone please help me out on this issue? KiT

      X Offline
      X Offline
      XRaheemX
      wrote on last edited by
      #2

      One quick and easy way (cheating a bit) to fix this is to simple subtract 543 years from the final date BEFORE you enter it into SQL ;P

      A 1 Reply Last reply
      0
      • X XRaheemX

        One quick and easy way (cheating a bit) to fix this is to simple subtract 543 years from the final date BEFORE you enter it into SQL ;P

        A Offline
        A Offline
        AesopTurtle
        wrote on last edited by
        #3

        I've tried that before but it didn't work. It seems like it adds 543 just before storing into the db. But when processing, it uses the displayed value. For example, if i try to store a year of 2520, it store 1977. But if i try -543, it says "Out of Range". What a headache... Don't know how to fix it. :(( KiT

        X 1 Reply Last reply
        0
        • A AesopTurtle

          I've tried that before but it didn't work. It seems like it adds 543 just before storing into the db. But when processing, it uses the displayed value. For example, if i try to store a year of 2520, it store 1977. But if i try -543, it says "Out of Range". What a headache... Don't know how to fix it. :(( KiT

          X Offline
          X Offline
          XRaheemX
          wrote on last edited by
          #4

          Unfortunately I don't know of a fix, perhaps though you can band-aid it on the other side? When you retrieve the data back out, add 543 to it.

          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