Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getChangeDateFormat(Date date) { String str = null; if (date != null && !"".equals(date)) { SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); str = sd.format(date); } return str; } }