Java Hour Format format1StringToformat2String(String dateStr)

Here you can find the source of format1StringToformat2String(String dateStr)

Description

format String Toformat String

License

Open Source License

Declaration

public static String format1StringToformat2String(String dateStr) throws ParseException 

Method Source Code


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

Related

  1. format(Number price)
  2. format(String format, Date val)
  3. format(String pattern)
  4. format(String str)
  5. format16ByDate(Date aDate)
  6. format2NormalTime(Date date)
  7. format_default(Date time)
  8. formatAbsoluteTime(long time)
  9. formatAddTime(Date addTime)