Java equivalent of .NET DateTime.MinValue, DateTime.Today

后端 未结 6 1268
梦毁少年i
梦毁少年i 2021-01-17 08:19

Is there a Java equivalent of DateTime.MinValue and DateTime.Today in the Java Date class? Or a way of achieving something similar?

I\'ve realised how spoilt you are

6条回答
  •  庸人自扰
    2021-01-17 09:14

    to get the current date:

    Calendar calendar = Calendar.getInstance(); SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");

        try {
    
            System.out.println("Today: " + dateFormat.format(calendar.getTime()));
    
        } catch (Exception e) {
            e.printStackTrace();
        }
    

提交回复
热议问题