Displaying AM and PM in lower case after date formatting

后端 未结 8 1109
谎友^
谎友^ 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 07:04

    just add toLowarCase() like this

    public class Timeis {
    public static void main(String s[]) {
          long ts = 1022895271767L;
          String st = null;  
          st = new SimpleDateFormat(" MMM d 'at' hh:mm a").format(ts).toLowerCase();
          System.out.println("time is " + ts);  
    }
    }
    

    and toUpperCase() if you want upper case

提交回复
热议问题