【发布时间】:2010-10-13 10:36:54
【问题描述】:
因此,例如,当我对日期进行 string.format 并在格式模式中使用字符串“或”时,我希望将其转换为日期的序数值。
即
string.Format("{0:ddor MMM yyyy}.", DateTime.Now)
应该输出
1st Jan 2010
关于如何推导序数,请参见下文
Is there an easy way in .NET to get "st", "nd", "rd" and "th" endings for numbers?
【问题讨论】:
标签: .net string.format ordinal datetimeformatinfo