Here you can find the source of numberToDate(String dateString)
public static Date numberToDate(String dateString)
//package com.java2s; /*/*w w w.j ava 2 s . com*/ * ================================================================== * The Huateng Software License * * Copyright (c) 2008-2012 TOPSCF All rights reserved. * ================================================================== */ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date numberToDate(String dateString) { if ("".equals(dateString) || dateString == null) { return null; } Date date = null; SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd"); try { date = simpleDateFormat.parse(dateString); } catch (ParseException e) { e.printStackTrace(); System.out.println("------SCFDataFormat>>StringTodate error=" + e); } return date; } }