1.获取年月日
Calendar aa=Calendar.getInstance(); int year=aa.get(Calendar.YEAR); int month=aa.get(Calendar.MONTH+1);
2.整体获取
Date date1=new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Timestamp date=new Timestamp(date1.getTime());
时间: 2024-10-27 07:34:59