Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai,
How to display DOB this format : 01-Jan-1985
in textbox.(dd-MMM-yyyy)

textbox1.text=01-Jan-1985

Regards,
Karthikeyan,
Bangalore.
Posted

Try this:
C#
textbox1.text=DateTime.Now.ToString("dd-MMM-yyyy");

or
C#
textbox1.text=(Convert.ToDateTime("1-1-1985")).ToString("dd-MMM-yyyy");


Output will be:
24-Sep-2012


--Amit
 
Share this answer
 
v3
Comments
pkarthionline 24-Sep-12 6:33am    
I don't need today date, DateTime.Now.ToString("dd-MMM-yyyy");

I need Birth date.like that(01-Jan-1985)(12-Sep-1989)
_Amy 24-Sep-12 6:44am    
I think there is no difference between this and your requirements. Anyway convert your date to DateTime and then try changing your format.

--Amit
So if you are getting the Birth date value from Database or from anywhere, them put that in one variable.
C#
DataTime birthDate = new DataTime(1985, 1, 1); // or get from Database.
textbox1.text = birthDate.ToString("dd-MMM-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