问题
I would like to format a standard .NET DateTime string as follows
2014-01-01 => Jan 2014
I can get the date form "January 2014" by using ToString("y") but how can I abbreviate the month?
Is this even possible?
C# Visual Studio 2012 .NET 4.5
回答1:
You can use the MMM format as in:
DateTime.Now.ToString("yyyy-MM-dd => MMM yyyy")
Which produces:
2014-08-06 => Aug 2014
回答2:
You can use "MMM", take a look at this example: http://msdn.microsoft.com/library/zdtaw1bw%28v=vs.110%29.aspx
来源:https://stackoverflow.com/questions/25162808/formatting-date-string-abbreviating-month