Java Year Parse parseTimeByYYYYMMDDHHMMSS(String str)

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

Description

parse Time By YYYYMMDDHHMMSS

License

Open Source License

Declaration

public static int parseTimeByYYYYMMDDHHMMSS(String str) 

Method Source Code

//package com.java2s;
/*//from ww w .  j  av a2s  . com
 * Copyright 2010 Mttang.com All right reserved. This software is the
 * confidential and proprietary information of Mttang.com ("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 Mttang.com.
 */

import java.text.SimpleDateFormat;

public class Main {
    static final SimpleDateFormat yyyyMMddHHmmss = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public static int parseTimeByYYYYMMDDHHMMSS(String str) {
        if (str == null || str.length() != 19)
            return 0;
        try {
            return (int) (yyyyMMddHHmmss.parse(str).getTime() / 1000L);
        } catch (Exception ex) {
            return 0;
        }
    }
}

Related

  1. parseDateTime_mmddyyyy(String s)
  2. parseDateyyyy_MM_DD2(String ds)
  3. parseDateyyyyMMdd(String value)
  4. parseddMMyyyy(String dateStr)
  5. parseDdMmYyyyDate(String date)
  6. parseYYYYMMDD(String s)
  7. parseYYYYMMDD(String yyyyDashmmDashdd)
  8. parseYYYYMMDD(String yyyymmdd)
  9. parseYYYYMMDD(String yyyymmdd)