How to have dates in dd/mm/yyyy format?

G

Guest

Thanks Jlo,

But there's no customformat attribute in the rangevalidator

Im on .net 1.1

Is this a better option or shall i use web.config and modify the culture
settings?

If you do not set a proper culture for the application, you should use
a culture-neutral format, such as YYYY/MM/DD, for the MaximumValue and
MinimumValue properties. Otherwise, the date may not be interpreted
correctly. In other case, change a culture, either in web.config, or
on the page, e.g. <%@ Page Language="C#" Culture="en-GB" %>
 
E

Eric Layman

Hi,

In general, how do u configure/script to allow .net to accept date in
dd/mm/yyyy format?

By default, my sys only allows mm/dd/yyyy format.

Eg:

Take alook at

<asp:RangeValidator ID="RangeValidator1"

ControlToValidate="dob"

MinimumValue="01/01/1901"

MaximumValue="31/12/2001"

Type="Date"

EnableClientScript="true"

Text="The date must be between 01/01/1901 and 31/12/2001."

runat="server" />



Even if I key in 31/12/2001, i would hit an exception error. This happens
because 31/12/2001 is regarded as mm/dd/yyyy !

But I want my format to be in dd/mm/yyyy.

Users have to key in dd/mm/yyyy format.


Can someone give some pointers? Thanks
 
E

Eric Layman

Thanks Jlo,

But there's no customformat attribute in the rangevalidator

Im on .net 1.1

Is this a better option or shall i use web.config and modify the culture
settings?

Jlo said:
Hi, set the customFormat to "dd/MM/yyyy"
and format to custom


Eric Layman said:
Hi,

In general, how do u configure/script to allow .net to accept date in
dd/mm/yyyy format?

By default, my sys only allows mm/dd/yyyy format.

Eg:

Take alook at

<asp:RangeValidator ID="RangeValidator1"

ControlToValidate="dob"

MinimumValue="01/01/1901"

MaximumValue="31/12/2001"

Type="Date"

EnableClientScript="true"

Text="The date must be between 01/01/1901 and 31/12/2001."

runat="server" />



Even if I key in 31/12/2001, i would hit an exception error. This happens
because 31/12/2001 is regarded as mm/dd/yyyy !

But I want my format to be in dd/mm/yyyy.

Users have to key in dd/mm/yyyy format.


Can someone give some pointers? Thanks
 

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,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top