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. Working with dates

Working with dates

Scheduled Pinned Locked Moved Visual Basic
csharphelptutorialquestion
3 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    HI guys, I'm a student and need some help with dates in VB.NET. What do I do to verify that date values are input correctly on a form? This includes the following: The day, month and year are entered separately; One cannot (obviously!) be born on day 0 of month 13, or on 29 February 2003. I've never worked with dates and don't know how to go about this. Can someone please help me here? MichMar

    H G 2 Replies Last reply
    0
    • L Lost User

      HI guys, I'm a student and need some help with dates in VB.NET. What do I do to verify that date values are input correctly on a form? This includes the following: The day, month and year are entered separately; One cannot (obviously!) be born on day 0 of month 13, or on 29 February 2003. I've never worked with dates and don't know how to go about this. Can someone please help me here? MichMar

      H Offline
      H Offline
      HaloZa
      wrote on last edited by
      #2

      With the day, month and year being inserted separately ... it can be easy to check. some normal logic You will ask the year first because of leap years and stuff. Next the month will be enetered in if EnteredMonth > 0 and EnteredMonth < 13 then 'month is a correct month else 'month is not correct end if then when u know the month you can demine if the month has 30/31/28 or 29 days and the day can be checked to see if it falls in the bounds here is just a basic layout that you can change to suit your variables ect .. i think that more than explains it how i would go about it if year = leapyear then else ' not a leap year if month = 4 or month = 6 the 'all the months that have 30 days if enteredday > 0 and enteredday < 31 then 'date is correct else 'error end if end if if month = 5 or month = 3 then 'all the months that have 31 days if enteredday > 0 and enteredday < 32 then 'date is correct else 'error end if if month = 2 then 'month is feburary end if end if end if

      1 Reply Last reply
      0
      • L Lost User

        HI guys, I'm a student and need some help with dates in VB.NET. What do I do to verify that date values are input correctly on a form? This includes the following: The day, month and year are entered separately; One cannot (obviously!) be born on day 0 of month 13, or on 29 February 2003. I've never worked with dates and don't know how to go about this. Can someone please help me here? MichMar

        G Offline
        G Offline
        Guerven
        wrote on last edited by
        #3

        use a datetimepicker control GUERVEN Truth or Consequence

        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