format date from “MMM dd, yyyy HH:mm:ss a” to "MM.dd

后端 未结 2 548
野性不改
野性不改 2021-01-18 06:41

I want to format date from \"MMM dd, yyyy HH:mm:ss a\" to \"MM.dd\". I have following code

SimpleDateFormat ft = new SimpleDateFormat (\"MMM dd, yyyy hh:mm:s         


        
2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-18 07:27

    SimpleDateFormat sdf = new SimpleDateFormat("MM.dd", Locale.US);
    System.out.println("Formatted Date: " + sdf.format(date));
    

提交回复
热议问题