Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date format check? 2

Status
Not open for further replies.

99mel

Programmer
Oct 18, 1999
379
0
0
GB
Hi all,

Right, I have a date which I want to check its in the right format i.e "dd/mm/yyyy"

How would i go about doing this?

If the date is like 01/012000 i just want to show an error bc its not dd/mm/yyyy.

Thanks for any help!

Mel
 
use isdate function

ie if isdate(value)<>true then
error meesage
end if
::)
 
The IsDate won't check for formatting issues, it's not that picky. You could use the IsDate to verify that you can convert it to a date and then use the Format function to put it in the format you want.
Code:
If IsDate(DateStr) Then
  Text1.Text = Format(DateStr, &quot;DD/MM/YYYY&quot;)
Else
   MsgBox &quot;Invlid Date&quot;
End If

Good luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top