How to get the number of milliseconds elapsed so far today

后端 未结 4 742
攒了一身酷
攒了一身酷 2021-02-13 07:02

I want to get the current time and date in milliseconds. How can I get this?

I tried this:

Date date=new Date() ;  
System.out.println(\"Today is \" +dat         


        
4条回答
  •  礼貌的吻别
    2021-02-13 08:01

    Use this code to get the current date and time

    DateFormat dateFormat = new SimpleDateFormat("dd:MM:yyyy HH:mm:ss");
            Calendar calendar=Calendar.getInstance();
            Date date=calendar.getTime();
            date.getHours();
            date.getMinutes();
            date.getMonth();
            date.getSeconds();
            date.getYear();
    

提交回复
热议问题