tags:

views:

102

answers:

3

I have a DateTime saved in dtmNextPayment. I want that to showed in the label in mm/dd/yyyy way. I have tried using

lbltakeeffectdate.Text = dtmNextPayment.ToString("mm/dd/yyyy");

But month is always shown as 00. I have no idea why? Please let me know what should be the problem..

And also, please tell me what is the best solution.. Thank you so much!!

+15  A: 

Month is "MM". "mm" is minutes.

Full list of available custom datetime formats (along with examples) is here: http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx

Anna Lear
+3  A: 

You need to use MM. Capital M is month, little m is minutes

Benjamin Anderson
+2  A: 
lbltakeeffectdate.Text = dtmNextPayment.ToString("MM/dd/yyyy")

List of Format Options

Barry
Don't forget your quotes...
Greg
@Greg - oops! Did a cheeky copy and paste from the OP. thanks.
Barry