Java Year Format yyyyMMddHHmmss2date(String str)

Here you can find the source of yyyyMMddHHmmss2date(String str)

Description

yyyy M Mdd H Hmmssdate

License

Apache License

Declaration

public static Date yyyyMMddHHmmss2date(String str) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    private final static String yyyyMMddHHmmss = "yyyy-MM-dd HH:mm:ss";

    public static Date yyyyMMddHHmmss2date(String str) {
        DateFormat format = new SimpleDateFormat(yyyyMMddHHmmss);
        Date date = new Date();
        try {/* ww w  . jav  a 2  s. c  o  m*/
            date = format.parse(str);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return date;
    }
}

Related

  1. unmarshalYYYYMMDD(String date)
  2. yyyyMMdd(Date date)
  3. yyyyMMdd(Date date)
  4. yyyymmddFormat(Date date)
  5. yyyyMMddFormatter()
  6. yyyyMMddStringToDate(String date)