Java Year Format getYyyyMMddDate(String s)

Here you can find the source of getYyyyMMddDate(String s)

Description

get Yyyy M Mdd Date

License

Open Source License

Declaration

public static Date getYyyyMMddDate(String s) 

Method Source Code

//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;
        }
    }
}

Related

  1. getYYYYMM()
  2. getYYYYMM(final Date date, final String separator)
  3. getYYYYMMDD(Date date)
  4. getYYYYMMDD(Date date)
  5. getYYYYMMDD(int y, int m, int d)
  6. getyyyyMMddDateStr(Date date)
  7. getYYYYMMDDFormat()
  8. getYYYYMMDDHH(Date date)
  9. getYYYYMMDDHHMISS()