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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

compare dates

Status
Not open for further replies.

wafabekhti

Programmer
Dec 22, 2003
3
US
How do I compare 2 dates entered in a text box as mm/dd/yy to make sure that txtDate1.text < txtDate2.text ?
 
if format(text1.text,&quot;mm/dd/yy&quot;) < format(text2.text,&quot;mm/dd/yy&quot;) then
do something
else

end if

bb
 
If CDate(txtDate1.text) < CDate(txtDate2.text) Then

BTW: If you can get your users to enter dates in ISO-8601 format, you can do a text compare, because the format naturally sorts:
YYYY-MM-DD

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top