473,387 Members | 1,590 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Validating Dates d/mm/yyyy

I'm using this CompareValidator to validate dates but my default its
mm/dd/yyyy
<asp:CompareValidator ControlToValidate="DOB" Display="Dynamic"
Text="Invalid birth date!" Operator="DataTypeCheck"
Type="Date" Runat="Server" ID="DOBcompval" />
Is there a way i can change it to dd/mm/yyyy of course if not using
RegularExpressionValidator
Any ideas
Nov 19 '05 #1
2 3675
The validators use the current culture and the system's configuration in the
Regions settings to determine what the proper format is. You can change the
culture at the page or application level via:

<%@ Page Culture="es-MX" UICulture="es-MX" %>
which is "Spanish - Mexico"

OR

<configuration><system.web>
<globalization culture="es-MX" uiCulture="es-MX" />
</system.web></configuration>

Of course, the regularexpression is always an option, or you can validate on
the server using Date.ParseExact.

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Patrick.O.Ige" <na********@hotmail.com> wrote in message
news:uZ****************@TK2MSFTNGP10.phx.gbl...
I'm using this CompareValidator to validate dates but my default its
mm/dd/yyyy
<asp:CompareValidator ControlToValidate="DOB" Display="Dynamic"
Text="Invalid birth date!" Operator="DataTypeCheck"
Type="Date" Runat="Server" ID="DOBcompval" />
Is there a way i can change it to dd/mm/yyyy of course if not using
RegularExpressionValidator
Any ideas

Nov 19 '05 #2
Thx Karl.
Didn't just think of changing the glob culture..
That could have done the trick faster than using regex :(
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:eA**************@TK2MSFTNGP10.phx.gbl...
The validators use the current culture and the system's configuration in the Regions settings to determine what the proper format is. You can change the culture at the page or application level via:

<%@ Page Culture="es-MX" UICulture="es-MX" %>
which is "Spanish - Mexico"

OR

<configuration><system.web>
<globalization culture="es-MX" uiCulture="es-MX" />
</system.web></configuration>

Of course, the regularexpression is always an option, or you can validate on the server using Date.ParseExact.

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Patrick.O.Ige" <na********@hotmail.com> wrote in message
news:uZ****************@TK2MSFTNGP10.phx.gbl...
I'm using this CompareValidator to validate dates but my default its
mm/dd/yyyy
<asp:CompareValidator ControlToValidate="DOB" Display="Dynamic"
Text="Invalid birth date!" Operator="DataTypeCheck"
Type="Date" Runat="Server" ID="DOBcompval" />
Is there a way i can change it to dd/mm/yyyy of course if not using
RegularExpressionValidator
Any ideas


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: F | last post by:
Hi I have posted the question few days back about problem in inserting the dates in SQL server and thankful to them who replied. That was solved and this is a nice solution....
4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
6
by: Michael Hill | last post by:
I have this large array with dates in it. There is a function that sorts it for me. The only problem is that in order for it to get sorted properly I have to sort it AlphaNumerically first using ...
4
by: John | last post by:
Hi I have a web control text box on my webform which I want to use for entering dates. Is there a way to validate this text box field for valid dates? May be using a validators such as regular...
2
by: Yog | last post by:
Is there a best way to handle various formats of dates for SQL server?. The data comes in various input files with different date formats. The ParseExact function looks like an "evil" and it...
1
by: viki.sanjeeva | last post by:
Hi, There is a date field in JSP form where user will enter date in dd-mm-yyyy format. Now before saving into DB2, I want to validate the date format against dd-mm-yyyy format and then save into...
12
by: Dixie | last post by:
I am trying to calculate the number of workdays between two dates with regards to holidays as well. I have used Arvin Meyer's code on the Access Web, but as I am in Australia and my date format is...
10
by: John | last post by:
Hi I have a form with tow fields for dates in dd/mm/yyyy format. I am trying to use the fields in a query's where clause as below; "SELECT * " & _ "FROM Orders " & _ " WHERE Orders.)>= #" &...
1
by: magicscreen | last post by:
I am trying to create a CSV export file that has a date field. If you look at the table in Access the date looks like mm/dd/yyyy. I want to run the export wizard to create a spec so I can use it...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.