package zuoye; import java.text.SimpleDateFormat; import java.util.Date; public class Demo07 { public static void main(String[] args) { Date date = new Date(); String week = "星期" + date.getDay(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String time = simpleDateFormat.format(date); System.out.println(time + " " + week); } }
这种题目的解决方法有多种,本种方法仅供参考