Click here to Skip to main content
15,887,946 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi

My Date output in Label is 8/11/2011 12:00:00 AM
i want it to be 8-November-20011

Thanks
Posted
Comments
S.P.Tiwari 6-Dec-11 4:51am    
hi you are not ok with my solution...?

 
Share this answer
 
Comments
Lancy.net 6-Dec-11 6:56am    
Thanks
Wendelius 6-Dec-11 7:42am    
You're welcome :)
change the following properties of datetimepicker

Format: Custom
Custom Format: dd-MMM-yyyy
 
Share this answer
 
C#
function MakedateFormat(format) {
           if (format != null) {
               if (format.search("/") || format.search("-") || format.search(" ")) {
                   var array = format.split(new String("/", "-", " "), 10);
                   var month = array[1];
                   switch (month) {
                       case "Jan":
                           array[1] = "01";
                           break;
                       case "Feb":
                           array[1] = "02";
                           break;
                       case "Mar":
                           array[1] = "03";
                           break;
                       case "Apr":
                           array[1] = "04";
                           break;
                       case "May":
                           array[1] = "05";
                           break;
                       case "Jun":
                           array[1] = "06";
                           break;
                       case "Jul":
                           array[1] = "07";
                           break;
                       case "Aug":
                           array[1] = "08";
                           break;
                       case "Sep":
                           array[1] = "09";
                           break;
                       case "Oct":
                           array[1] = "10";
                           break;
                       case "Nov":
                           array[1] = "11";
                           break;
                       case "Dec":
                           array[1] = "12";
                           break;
                   }
                   var realyear = array[2];
                   array[2] = parseInt(realyear); //+ parseInt(2000));
                   format = array[0] + "/" + array[1] + "/" + array[2];
                   return format;
               }
           }
           return format;
       }



try the above javascript method. just chnage the month in their full form.
 
Share this answer
 
Comments
Lancy.net 6-Dec-11 6:57am    
Thanks
S.P.Tiwari 7-Dec-11 0:23am    
your welcome
Try this code:
DateTime thisDate = new DateTime(2011, 6, 10);
thisDate.ToString("d"-"MMMM"-"yyyy")
 
Share this answer
 
See this my friend. Format it in SQL

http://www.sql-server-helper.com/tips/date-formats.aspx[^]

Regards,
Eduard
 
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