Displaying AM and PM in lower case after date formatting

后端 未结 8 1108
谎友^
谎友^ 2020-11-27 06:40

After formatting a datetime, the time displays AM or PM in upper case, but I want it in lower case like am or pm.

This is my code:

public class Timei         


        
8条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-27 06:48

    Try this:

    System.out.println("time is " + ts.toLowerCase());
    

    Although you may be able to create a custom format as detailed here and here

    Unfortunately out of the box the AM and PM do not seem to be customisable in the standard SimpleDateFormat class

提交回复
热议问题