Java tutorial
//package com.java2s; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { /** * * @param date * @return */ public static Date getDate(String date) { if ("".equals(date) || date == null || "null".equals(date)) { return null; } else { String[] obj = date.split("-"); int year = Integer.valueOf((String) obj[0]).intValue(); int month = Integer.valueOf((String) obj[1]).intValue(); int day = Integer.valueOf((String) obj[2]).intValue(); Calendar calendar = new GregorianCalendar(year, month - 1, day); return calendar.getTime(); } } }