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. Visual Basic
  4. get date format

get date format

Scheduled Pinned Locked Moved Visual Basic
tutorialquestion
6 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.
  • J Offline
    J Offline
    Jayesh Talsaniya
    wrote on last edited by
    #1

    how to get the date format in vb? Jayesh Talsaniya

    N 1 Reply Last reply
    0
    • J Jayesh Talsaniya

      how to get the date format in vb? Jayesh Talsaniya

      N Offline
      N Offline
      NetRams
      wrote on last edited by
      #2

      Do you need to extract, month, day, year from date? use -> Date.month , Date.day, Date.year. Also you can convert date to shortdate, shorttime, longdate and longtime as string.

      Be simple and Be sample.

      J 1 Reply Last reply
      0
      • N NetRams

        Do you need to extract, month, day, year from date? use -> Date.month , Date.day, Date.year. Also you can convert date to shortdate, shorttime, longdate and longtime as string.

        Be simple and Be sample.

        J Offline
        J Offline
        Jayesh Talsaniya
        wrote on last edited by
        #3

        no i dont mean that. i want to check the format fo the date that is in the textbox contol. wether it is dd/mm/yyyy or /mm/dd/yyyy or other.... Jayesh Talsaniya

        N 1 Reply Last reply
        0
        • J Jayesh Talsaniya

          no i dont mean that. i want to check the format fo the date that is in the textbox contol. wether it is dd/mm/yyyy or /mm/dd/yyyy or other.... Jayesh Talsaniya

          N Offline
          N Offline
          NetRams
          wrote on last edited by
          #4

          In VB.net there is no direct control to check format. Try with masked text box. You have to write own code on keypress event - first 2 digit should be below 12 (if it is month) and so on.

          Be simple and Be sample.

          J 1 Reply Last reply
          0
          • N NetRams

            In VB.net there is no direct control to check format. Try with masked text box. You have to write own code on keypress event - first 2 digit should be below 12 (if it is month) and so on.

            Be simple and Be sample.

            J Offline
            J Offline
            Jayesh Talsaniya
            wrote on last edited by
            #5

            oh is it so? k thanx for replying. now i wil code for that. regards Jayesh Talsaniya

            D 1 Reply Last reply
            0
            • J Jayesh Talsaniya

              oh is it so? k thanx for replying. now i wil code for that. regards Jayesh Talsaniya

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

              Unless you limit the input of the user, there's no way to tell what format the date is in, reliably. Think about it. Which number is the month and which is the day in "6/6/07"? With restricting the user to a known format, it's impossible to tell. You could get a good clue if you looked at the culture information though. Chances are, the entered date will follow the standard format for a country. Mostly... Check out the CultureInfo class. You can get the current culture your code is running under and get the DateTimeFormat from there. This would be the culture of the O/S is setup for, NOT necessarily the one the user typed into a TextBox.

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

              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