Click here to Skip to main content
15,891,423 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to convert date 10/05/2014 to 10-May-2014 in asp .net
Posted
Updated 1-Sep-14 20:07pm
v2
Comments
Thanks7872 2-Sep-14 1:56am    
10/05/2014. Is it dd/MM/yyyy or MM/dd/yyyy? How August came into picture?
Khan Sameer 2-Sep-14 2:02am    
that is just an example ok no problem let me know how to convert date 10/05/2014 to 10-May-2014 in asp .net

string date = Convert.ToDateTime("10 / 05 / 2014").ToString("dd-MMM-yyyy");
 
Share this answer
 
Comments
Khan Sameer 2-Sep-14 2:15am    
Thnks a lot this solution solved my problem !!!!!!
Sanchayeeta 2-Sep-14 2:17am    
Welcome :)
C#
string formattedDate = YourDate.ToString("dd MMM yyyy");
 
Share this answer
 
Comments
Khan Sameer 2-Sep-14 1:58am    
Error The best overload method has some invalid arguments
Thanks7872 2-Sep-14 2:02am    
dd MMM yyyy is not a format OP has asked for.
Khan Sameer 2-Sep-14 2:05am    
please give me the solution
Gihan Liyanage 2-Sep-14 2:11am    
Try this link, and search for your requirement
http://www.csharp-examples.net/string-format-datetime/
Gihan Liyanage 2-Sep-14 2:13am    
IF you understand the format that he expect, then its better to write the answer. Because he is expecting the answer
I am assuming you have 10/05/2014 as string, not a DateTime. So solution would be
C#
string time = DateTime.ParseExact("10/05/2014","dd/MM/yyyy",CultureInfo.InvariantCulture).ToString("dd-MMM-yyyy");

If its DateTime than just ToString("dd-MMM-yyyy") will work.

Regards..
 
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