jdk原生public class Start { public static void main(String[] args) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); String time = simpleDateFormat.format(new Date()); System.out.println(time); } }