Click here to Skip to main content
15,901,122 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have two radio button like MM/DD/YY and 2nd radio button DD/MM/YY.
and one one submit button.
when i select any format it will change data format whole project.how it is possible.
what should i have to do????
Web Application with ASP.NET

Thanks
Posted

Use following code for your respective radio button:
SQL
SELECT CONVERT(VARCHAR(8), GETDATE(), 3) AS [DD/MM/YY]

SQL
SELECT CONVERT(VARCHAR(8), GETDATE(), 1) AS [MM/DD/YY]
 
Share this answer
 
Comments
nawabprince 5-Mar-12 6:21am    
Thank alot Parad..
Prasad_Kulkarni 5-Mar-12 6:56am    
You're welcome,its Pashad.
nawabprince 5-Mar-12 7:34am    
i m apologize for wrong spelling of ur name..my mistake..Thanks again bro
Prasad_Kulkarni 6-Mar-12 7:49am    
its fine, if the answer is useful then click on green button 'Accept Solution'
 
Share this answer
 
When you change the system date format, it will apply to the entire date fields in the whole project. To change a specific field, you should use TryPaseExact method of DateTime .NET class as:

C#
string pattern = "MM-dd-yy";
string dateValue = "30-12-2011";
DateTime parsedDate;

DateTime.TryParseExact(dateValue, pattern, null, DateTimeStyles.None, out parsedDate)
 
Share this answer
 

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