How to Format Date in asp.net

Posted by Juvy_Paira under ASP.NET on 1/14/2013 | Points: 10 | Views : 1152 | Status : [Member] | Replies : 5
Hi guys,

How to formatdate? Like if i have a date "January 7,2013" i want to get "01-07-2013" ?

Please help..Thanks a lot...




Responses

Posted by: Nisar87 on: 1/14/2013 [Member] Starter | Points: 25

Up
0
Down

DateTime dt = new DateTime();
string strdate = String.Format("{0:MM-dd-yyyy}", dt);


_______________________________________
Nisar Ahmad
http://www.dotnetobject.com/

Juvy_Paira, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 1/15/2013 [Member] [MVP] Gold | Points: 25

Up
0
Down
Try this,

DateTime dt=Convert.ToDateTime("January 7,2013");
string DateT = dt.ToString("MM-dd-yyyy");


Mark As Answer if this helps you

.

Juvy_Paira, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Juvy_Paira on: 1/16/2013 [Member] Starter | Points: 25

Up
0
Down
Thank you for your response guys.

Juvy_Paira, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 1/16/2013 [Member] [MVP] Gold | Points: 25

Up
0
Down
Please Mark As Answer if this helps you

.

Juvy_Paira, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Juvy_Paira on: 1/17/2013 [Member] Starter | Points: 25

Up
0
Down
Thank you, i already got it before the replies... Thanks a lot.

Juvy_Paira, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response