Java Hour Format formatDate(String inputStr)

Here you can find the source of formatDate(String inputStr)

Description

format Date

License

Apache License

Parameter

Parameter Description
inputStr a parameter

Declaration

public static String formatDate(String inputStr) 

Method Source Code


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

import java.text.ParseException;
import java.text.SimpleDateFormat;

public class Main {
    /**/*ww  w.java 2 s.com*/
     * @param inputStr
     * @return
     */
    public static String formatDate(String inputStr) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try {
            return sdf.format(sdf.parse(inputStr));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return "";
    }
}

Related

  1. formatDate(Object obj, String format)
  2. formatDate(String date)
  3. formatDate(String date)
  4. formatDate(String dateTimeString)
  5. formatDate(String format)
  6. formatDate(String pattern, Date date)
  7. formatDate2DateTimeStr()
  8. formatDate2DateTimeStr()
  9. formatDate3DateTimeStr(Date date)