Here you can find the source of parse(String source)
private static Date parse(String source)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy/MM/dd"); private static Date parse(String source) { if (source.equalsIgnoreCase("today")) { return new Date(); }/* www . j av a 2 s . c o m*/ if (source.equalsIgnoreCase("yesterday")) { Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, -1); return cal.getTime(); } try { return DATE_FORMAT.parse(source); } catch (ParseException e) { return null; } } }