Java Date String Format dateFormat(String datetime)

Here you can find the source of dateFormat(String datetime)

Description

date Format

License

Apache License

Declaration

public static String dateFormat(String datetime) 

Method Source Code

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

public class Main {

    public static String dateFormat(String datetime) {
        String date = "";
        if (datetime != null && !"null".equals(datetime.trim()) && !"".equals(datetime.trim())
                && datetime.length() > 10) {
            if ("00:00:00".equals(datetime.substring(11, 19))) {
                date = datetime.substring(0, 10);
            } else {
                date = datetime.substring(0, 19);
            }/* w  ww. java  2 s .com*/
        } else {
            date = datetime;
        }
        return date;
    }
}

Related

  1. dateFormat(String date)
  2. dateFormat(String strYear, String strMonth, String strDay)
  3. dateFormatFix(String str)
  4. formatDate(byte[] btValue, int iOffset, int iLength)
  5. formatDate(int year, int month, int day)