Click here to Skip to main content
15,881,139 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,

I have a project in ASP.Net which contains around 1200 forms. It is being used by both the indian clients and the US clients.

I have written all the code for all the forms and taken the date format in dd/MM/yyyy, according to indian format but as the americans write date in MM/dd/YYYY; the clients are requiring that they must be able to enter the date only in their format i.e., MM/dd/YYYY where there are textboxes for the same.

But as i have written all the code in dd/MM/yyyy format and all the computing part is done in the same format only it will be impossible for me to change alogether the code.

So, now i am requiring some custom textbox control which validates the US clients, while filling the text box with date in format MM/dd/YYYY; but still does the computing part in the format dd/MM/yyyy.

Is there any alternative solution to this then kindly let me know.

Thanks

Varun Sareen
Posted
Comments
Technoses 20-Apr-12 7:10am    
what you have done for taking input like dd/MM/yyyy??

1 solution

Just do as follows

C#
DateTime startDate = new DateTime(2010, 01, 01);
string customFormat = "MM/dd/yyyy";

txtStartDate.Text = startDate.ToString(customFormat);


It will work.
Note: Check format should be exactly same as "MM/dd/yyyy".
 
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