Comparing dates entered from a form

H

hansiman

In a form a user enteres two dates (from and to) in format dd-mm-yyyy.

How do I check if to >= from.

All the different attempts end up in "String was not recognized as a
valid DateTime" when I try to convert "24-12-2002"

Dim dateFrom As DateTime = Convert.ToDateTime(txtFrom.Text)
Dim dateTo As DateTime = Convert.ToDateTime(txtTo.Text)

I'd like not to have to manually break up the entered string into its
day, month and year parts - day = left(txtTo.Text, 2) only to
re-assemble and then compare.

Any suggestions?

/Morten
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top