How to check a valid date...

Thread Solved
Reply

Join Date: Jun 2009
Posts: 5
Reputation: fernando82 is an unknown quantity at this point 
Solved Threads: 0
fernando82 fernando82 is offline Offline
Newbie Poster

How to check a valid date...

 
0
  #1
Jun 29th, 2009
Hi everyone!
I have a problem related with dates.... i have some textbox where i put dates to send to a database... i have conditioned the input just for numbers and / (backslash), but how do i check that no one inserts a format that's not dd/mm/yyyy... if i put 1234 sends an error and stops

Thanks everyone!
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 830
Reputation: wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all 
Solved Threads: 94
wildgoose's Avatar
wildgoose wildgoose is offline Offline
Practically a Posting Shark

Re: How to check a valid date...

 
0
  #2
Jun 29th, 2009
You have to parse each field and check to see if its legitimate.
Also check the day number to number of days in that month.
And double check if its a leap year or not.
You could parse and convert to Julian and store as a 32-bit number.
You may want to consider allowing dwarf entries so that for example today is 6/29/2009 but if someone enter 7/11 it will exchange 7/11 for 7/11/2009 automatically or with a verify! It gets very old having to enter a complete date every time!
You may consider a date split - six months vs + six months so that for example entry of past invoices allows a dwarf date!
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 784
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 139
vb5prgrmr vb5prgrmr is offline Offline
Master Poster

Re: How to check a valid date...

 
0
  #3
Jun 29th, 2009
IsDate anybody???

Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 5
Reputation: fernando82 is an unknown quantity at this point 
Solved Threads: 0
fernando82 fernando82 is offline Offline
Newbie Poster

Re: How to check a valid date...

 
0
  #4
Jun 30th, 2009
Thanks to both of you!

The IsDate solution works perfectly... of course i'll check the other options, thanks!
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 70
Reputation: kehar is an unknown quantity at this point 
Solved Threads: 0
kehar kehar is offline Offline
Junior Poster in Training

Re: How to check a valid date...

 
0
  #5
Jul 3rd, 2009
Add MS Mask Edit control in your form and under its Property go to
mask and enter ##/##/#### then
run the programme and give focus. you can enter your own date without using dtpicker.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC