package leetcode; import java.text.SimpleDateFormat; import java.util.Date; public class Solution{ public static void main(String[] args) { SimpleDateFormat df =new SimpleDateFormat("yyyy-mm-dd HH:mm:ss"); System.out.println("当前时间为:"+df.format(new Date())); } }