C# ToString("MM/dd/yy") remove leading 0's [duplicate]
Possible Duplicate:
Format .NET D开发者_C百科ateTime “Day” with no leading zero
Is there a way to remove the leading zeros in the date format
For example, X.ToString("MM/dd/yy") returns 07/02/11 but I'd like it to instead return 7/2/11.
Is this possible?
Thanks
X.ToString("M/d/yy") is what you need
Just remove the extra M and d.
You can use "M/d/yy". See here for more details.
You can write X.ToString("M/d/yy")
It is X.ToString("M/d/y") if you want to remove ALL leading zeroes ;)
加载中,请稍侯......
精彩评论