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. system date format

system date format

Scheduled Pinned Locked Moved Visual Basic
help
5 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.
  • P Offline
    P Offline
    pathak78
    wrote on last edited by
    #1

    I have developed a program with too many date fields. I have used datetimepicker for this with formating dd/MM/yyyy. This will create problem if any user have system date format in m/d/yyyy So I want that when my program start it will detect system date format and if format is in m/d/yyyy then it converts into mm/DD/yyyy and at the time of closing my program it converts into it's original format. If any one have any code in support of this problem, please send me immediatly. Thanks Pathak

    R 1 Reply Last reply
    0
    • P pathak78

      I have developed a program with too many date fields. I have used datetimepicker for this with formating dd/MM/yyyy. This will create problem if any user have system date format in m/d/yyyy So I want that when my program start it will detect system date format and if format is in m/d/yyyy then it converts into mm/DD/yyyy and at the time of closing my program it converts into it's original format. If any one have any code in support of this problem, please send me immediatly. Thanks Pathak

      R Offline
      R Offline
      Rajesh Anuhya
      wrote on last edited by
      #2

      hiiiiiiii..,, why are u trying to change the system date format, change your datetimepicker format to system format. use below code Format(DateTimePicker4.Value, "yyMMdd") thanks Bye..

      Rajesh B --> A Poor Workman Blames His Tools <--

      P 1 Reply Last reply
      0
      • R Rajesh Anuhya

        hiiiiiiii..,, why are u trying to change the system date format, change your datetimepicker format to system format. use below code Format(DateTimePicker4.Value, "yyMMdd") thanks Bye..

        Rajesh B --> A Poor Workman Blames His Tools <--

        P Offline
        P Offline
        pathak78
        wrote on last edited by
        #3

        If any user have date format in dd/MM/yyyy then I save 08/04/2008, it saved same and displayed in same format. but if he changed his format in m/d/yyyy and i give 08/04/2008 then when we retrive date it shows lik 04/08/2008. And if use format here then it creates problem with dd/MM/yyyy format.

        D M 2 Replies Last reply
        0
        • P pathak78

          If any user have date format in dd/MM/yyyy then I save 08/04/2008, it saved same and displayed in same format. but if he changed his format in m/d/yyyy and i give 08/04/2008 then when we retrive date it shows lik 04/08/2008. And if use format here then it creates problem with dd/MM/yyyy format.

          D Offline
          D Offline
          darkelv
          wrote on last edited by
          #4

          The format is just change the display. The .Value is still a DateTime type. Unless you use ToString() and not the DateTime value, then you got to look at how you save and retrieve the value.

          1 Reply Last reply
          0
          • P pathak78

            If any user have date format in dd/MM/yyyy then I save 08/04/2008, it saved same and displayed in same format. but if he changed his format in m/d/yyyy and i give 08/04/2008 then when we retrive date it shows lik 04/08/2008. And if use format here then it creates problem with dd/MM/yyyy format.

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

            As darklev pointed out, your base error is if you are storing your dates as a string. If you are using a database then you MUST use the date data type to store your data. If you persist in using a string to store the date your will never be free of the formating problem.

            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