Here you can find the source of parseSalesDate(final String ymd)
public static Date parseSalesDate(final String ymd)
//package com.java2s; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String H_DATE_FROMAT = "yyyyMMdd"; public static Date parseSalesDate(final String ymd) { if (ymd == null || ymd.isEmpty()) { return null; }//from w w w . j a v a2s .co m final DateFormat dateFormat = new SimpleDateFormat(H_DATE_FROMAT); Date tmp; try { tmp = dateFormat.parse(ymd); } catch (ParseException e) { return null; } return tmp; } }