Here you can find the source of getYyyyMMddDate(String s)
public static Date getYyyyMMddDate(String s)
//package com.java2s; /**//from w ww . j a v a 2s.c o m * Project: guahao-portal-web-home * * File Created at 2012-9-26 * * Copyright 2012 Greenline.com Corporation Limited. * All rights reserved. * * This software is the confidential and proprietary information of * Greenline Company. ("Confidential Information"). You shall not * disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into * with Greenline.com. */ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date getYyyyMMddDate(String s) { if (s == null) { return null; } try { return new SimpleDateFormat("yyyyMMdd").parse(s); } catch (ParseException e) { return null; } } }