I have the doubt in date format

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sreekandan
    New Member
    • Nov 2006
    • 98

    I have the doubt in date format

    hi everybody, Now im doing one project.In that I have to insert the Date Of Birth field into the db table.For that, if anybody enter the DOB field,I have to check whether it is in the format of "DD/MM/YYYY" or not.I have written the code for that is If text1.text<>For mat$(DD/MM/YYYY) Then
    Msgbox"DOB Should Be The Format Of DD/MM/YYYY"
    But it hasn't succeeded. So kindly reply me anyone quickly.
  • sukeshchand
    New Member
    • Jan 2007
    • 88

    #2
    Dear sreekandan,
    i advice to use date fields in dd/MMM/yyyy format.....
    because here lots of chance to make mistake in day and month positions

    Comment

    • sreekandan
      New Member
      • Nov 2006
      • 98

      #3
      Originally posted by sukeshchand
      Dear sreekandan,
      i advice to use date fields in dd/MMM/yyyy format.....
      because here lots of chance to make mistake in day and month positions
      i tried with that code.But i couldn't get the right output.So kindly anyone reply me.

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by sreekandan
        i tried with that code.But i couldn't get the right output.So kindly anyone reply me.
        One thing you could try is If Not IsDate(text1.te xt) Then...

        Of course, one problem you may run across in such cases is people mixing up the month and the day. That's where using a non-numeric month can be useful. For example, 01/02/2003 is quite ambiguous, where "01 FEB 2003" is much harder to misinterpet.

        Another option is to use something like a Calendar or DateTimePicker or Masked Edit control, which only allows the user to enter a valid format.

        Comment

        • sreekandan
          New Member
          • Nov 2006
          • 98

          #5
          Originally posted by Killer42
          One thing you could try is If Not IsDate(text1.te xt) Then...

          Of course, one problem you may run across in such cases is people mixing up the month and the day. That's where using a non-numeric month can be useful. For example, 01/02/2003 is quite ambiguous, where "01 FEB 2003" is much harder to misinterpet.

          Another option is to use something like a Calendar or DateTimePicker or Masked Edit control, which only allows the user to enter a valid format.
          thanks.I tried with that code.So i got the proper output that what am i thought.

          Comment

          • sreekandan
            New Member
            • Nov 2006
            • 98

            #6
            Originally posted by Killer42
            One thing you could try is If Not IsDate(text1.te xt) Then...

            Of course, one problem you may run across in such cases is people mixing up the month and the day. That's where using a non-numeric month can be useful. For example, 01/02/2003 is quite ambiguous, where "01 FEB 2003" is much harder to misinterpet.

            Another option is to use something like a Calendar or DateTimePicker or Masked Edit control, which only allows the user to enter a valid format.
            If i want the format of "MM/DD/YYYY"
            Then, how can I write change the above code you have given?

            Comment

            • hariharanmca
              Top Contributor
              • Dec 2006
              • 1977

              #7
              Originally posted by sreekandan
              If i want the format of "MM/DD/YYYY"
              Then, how can I write change the above code you have given?
              Better you give one lable at the top of the text1.Text with caption of the date format which you need then onely it will users friendly.... Ok

              Comment

              Working...