import java.util.Date;
public class shijian {
public static void main(String[] args) {
Date date=new Date();
String year=String.format("%tY", date);
String month=String.format("%tm", date);
String day=String.format("%td", date);
String hour=String.format("%tH", date);
String minute=String.format("%tM", date);
String second=String.format("%tS", date);
System.out.println(year+"年"+month+"月"+day+"日");
System.out.println(hour+"时"+minute+"分"+second+"秒");
}
}
原文:https://www.cnblogs.com/3w1z3/p/10858439.html