Here you can find the source of getyyyy_MM_dd2(String date)
public static String getyyyy_MM_dd2(String date) throws ParseException
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { private final static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); public static String getyyyy_MM_dd2(String date) throws ParseException { if (date == null) return ""; return sdf.format(sdf.parse(date)); }//from w w w .j a v a2s. com }