Here you can find the source of format1StringToformat2String(String dateStr)
public static String format1StringToformat2String(String dateStr) throws ParseException
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { public static final SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static final SimpleDateFormat format2 = new SimpleDateFormat("yyyyMMddHHmmss"); public static String format1StringToformat2String(String dateStr) throws ParseException { return format2.format(format1.parse(dateStr)); }//from w w w. j a va 2 s.com }