任何人都可以告訴我最好的方法或解決方案,我將如何做到以下幾點?從日期時間月份和日期(字符串)中刪除'0'(數字)
string test = "21.12.2013";
我怎麼能現在刪除所有零的月份和日期的,但仍「保持」的日期時間邏輯:
//Example 1
string input = "06.10.2013" // 6th October
string output = "6.10.2013" //only remove '0' from the day
//Example 2
string input = "01.09.2012" // 1st September
string output = "1.9.2012" //remove from month and day
//Example 3
string input = "20.10.2011" // 20th October
string output = "20.10.2011" //should (must) stay!
我在下面的格式有日期時間(如字符串)
我也可以解析DateTime
如果這會讓它更容易,但是我希望你有我的想法...
任何幫助讚賞!
這是顯示,並不影響它的保存方式。找到您的正確表示法[here](http://msdn.microsoft.com/en-us/library/8kb3ddd4(v = vs.110).aspx)。 –