Here you can find the source of format(String dateString)
public static Date format(String dateString)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static SimpleDateFormat dateFormat4 = new SimpleDateFormat( "yyyy-MM-dd"); public static Date format(String formatString, String dateString) { try {/*from ww w . j av a 2s . c om*/ return (new SimpleDateFormat(formatString)).parse(dateString); } catch (ParseException e) { e.printStackTrace(); } return null; } public static Date format(String dateString) { try { return dateFormat4.parse(dateString); } catch (ParseException e) { e.printStackTrace(); } return null; } }