2

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!!

3 Answers 3

17

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

Sign up to request clarification or add additional context in comments.

Comments

3

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

Comments

2
lbltakeeffectdate.Text = dtmNextPayment.ToString("MM/dd/yyyy")

List of Format Options

1 Comment

@Greg - oops! Did a cheeky copy and paste from the OP. thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.