Here you can find the source of parseTimeByYYYYMMDDHHMMSS(String str)
public static int parseTimeByYYYYMMDDHHMMSS(String str)
//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; } } }