Here you can find the source of getyyyy_MM_dd(Date date)
public static String getyyyy_MM_dd(Date date)
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; public class Main { private final static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); public static String getyyyy_MM_dd(Date date) { if (date == null) return ""; return sdf.format(date); }//from w w w .ja va2s .c om public static Date getyyyy_MM_dd(String date) { try { return sdf.parse(date); } catch (ParseException e) { } return new Date(); } }