开发者

How to get month name and am/pm in lowercase

How to get month name and am/pm in lowercase

DateTime.Now.ToString("MMMM h:m tt");

this giving me capital letters, but I开发者_Go百科 want small letters.


You just need to use ToLower method

DateTime.Now.ToString("MMMM h:m tt").ToLower();


Given that everything else will be numeric, I think it's going to be easiest just to call ToLower on the result. I don't think there's anything you can do in the format string to force it to lower case.


You can use DateFormat Class and this static method will convert it to lower am pm

 Calendar calendar = Calendar.getInstance();
   String inFormat = "d MMM yyyy,h:mm aa";
   String dateString = DateFormat.format(inFormat, calendar).toString();

By converting the string into lowercase (which you are doing) your month will also be get converted into lower case suppose your the month is July then it will be converted to july. SO i think u can use the above method to convert specifically only am_pm into lower case

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜