Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am using calender extender in my application to a textbox.
but when i am entering the old dates like 80's and 90's it will show error
datetime is out of range.and i want date and time in dd/mm/yyyy formate

code::

convert.todatetime(txtdate.text);

can anyone help me out plz.
Posted

If you are talking of Ajaxcontrol Toolkit calendar extender or even any calendar extender it would definitely have formatting in it.

Eg:
Ajax Control Toolkit[^]
HTML
<ajaxToolkit:Calendar runat="server"
    TargetControlID="Date1"
    CssClass="ClassName"
    Format="MMMM d, yyyy"
    PopupButtonID="Image1" />
 
Share this answer
 
Pleae refer to
DateTimeFormatInfo dfi = new DateTimeFormatInfo("");
dfi.ShortDatePattern="d/MM/yyyy";
dt=Convert.ToDateTime("15/03/2002 09:09:54",dfi);
You can search msdn for more details.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900