Date Validation

K

Kerri

Hi,

I have an input box on an aspx page.

This allows a user to input a datre.

Does anyone know if there is a validation control I can
use to validate that (i) the valueinput is a date and (ii)
that it is in a certain format

I know I can achieve this using javascript but I want to
do this server side.

Thanks,
Kerri.
 
A

Anatoly

You may use ParseExact function within try..catch block.
ParseExact thows exception if input string doesn't suite for format
If you got exception: the date invalid
HTH
 

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,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top