DateTime类型ToString时要显示AM/PM怎么办


Explanation:tgives the first character of the AM/PM designator (the localized designator can be retrieved inDateTimeFormatInfo.AMDesignatorandDateTimeFormatInfo.PMDesignator). The\\Mescapes theMso thatDateTime.ToStringdoes not interpret it as part of the format string and print the numerical value of the month.

Note that once you do this you are explicitly being culture insensitive. For example, in Japan, the AM/PM designator differs in the second characters, not the first.


你可能感兴趣的:(toString)