开发者

Datetime format in C#

开发者 https://www.devze.com 2023-01-15 08:46 出处:网络
I have 开发者_开发百科a DateTime saved in dtmNextPayment. I want that to showed in the label in mm/dd/yyyy way. I have tried using

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


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


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


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

List of Format Options

0

精彩评论

暂无评论...
验证码 换一张
取 消