|
-
Aug 1st, 2005, 03:36 AM
#1
Thread Starter
Addicted Member
Validate Date Format
Hi guys,
how can i validate the entered date format by the user in the date textbox? because the format should be (mm/dd/yyyy)..
what if the user enters the following format (dd/mm/yyyy) and clicks on submit.. is there a way to validate in the server side other than using the 'Regular Expression Validator"??
ASP.NET/VB.NET
Regards,
Nina
-
Aug 1st, 2005, 03:40 AM
#2
Lively Member
Re: Validate Date Format
Hi Nina
I dont have much knowledge of VB.NET
iam pasting a code in C#.
See if u can find something equivalent for this in VB.NET
System.DateTime dt = Today;
hDate.Value = dt.ToString("dd/MM/yyyy",DateTimeFormatInfo.InvariantInfo);
//hDate is the name of text box
-Sachien
-
Aug 1st, 2005, 06:18 AM
#3
Addicted Member
Re: Validate Date Format
You can always use
VB Code:
Dim strDate as string = txtDate.text
If IsDate(strDate) then
'...
End If
It checks if the string strDate is a valid date.
-
Aug 1st, 2005, 11:26 PM
#4
Thread Starter
Addicted Member
Re: Validate Date Format
but it is not checking the date format!!!
-
Aug 1st, 2005, 11:51 PM
#5
Member
Re: Validate Date Format
cant you just use format("mm/dd/yyyy", stringname)
validation on client side is easier
-
Aug 2nd, 2005, 09:58 PM
#6
Addicted Member
Re: Validate Date Format
what's wrong with regularexpressions validator?
why not use it?
just curious
-
Dec 4th, 2005, 11:58 PM
#7
Fanatic Member
Re: Validate Date Format
can you show sample how to use regularexpressions validator to validate entry on a textbox.please.TIA
If a post has helped you then Please Rate it!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|