2015-12-09 36 views
0

我想以字符串形式獲取月份,但採用簡寫形式,例如,我想從2015年12月9日起獲取Dec。以簡寫形式獲取月份字符串

string month = date.ToString("MM"); //this give me the numerical value, not string 

string month = date.Month;//this also give numerical value 

strin month = date.ToString("MMMM"); //this give me the full name of month 

我怎麼能從日期得到'Dec'?

+0

' 「MMM」' - 參見[自定義的日期和時間格式字符串](https://msdn.microsoft.com/en-us/library/8kb3ddd4(V = vs.110)的.aspx ) –

回答

1

試試這個。

string month = date.ToString("MMM");

相關問題