import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;/*** @author silence* 日期时间格式转化为方便理解的格式*/
public class Demo1 {public static void main(String[] args) throws ParseException {//获得当前时间Date date = new Date();System.out.println(date);//按指定日期时间格式转化
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");String format = sdf.format(date);System.out.println(format);}}