package com.example.demo.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateTimeTrans {

    public static void main(String[] args) {
        
        Date date = new Date();
        try {
            date = new SimpleDateFormat("HH:mm").parse("13:12:11");
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        String now = new SimpleDateFormat("HH:mm").format(date);
        System.out.println(now);//13:12
    }
}

 

相关文章:

  • 2022-02-08
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-27
  • 2021-11-27
  • 2021-12-12
  • 2021-10-16
  • 2021-07-18
相关资源
相似解决方案