Java Date String to String dateToString(String date)

Here you can find the source of dateToString(String date)

Description

date To String

License

Apache License

Declaration

public static String dateToString(String date) 

Method Source Code

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

public class Main {

    public static String dateToString(String date) {
        String stringDate = "";
        if (date.length() == 10 && date.indexOf("-") > 0) {
            stringDate = getYYYYMMDD(date);
        } else {/*from w  w w .j  a v  a 2s  .  co m*/
            stringDate = date;
        }
        return stringDate;
    }

    public static String getYYYYMMDD(String date) {
        String YYYYMMDD = "";
        YYYYMMDD = date.substring(0, 4) + date.substring(5, 7) + date.substring(8);
        return YYYYMMDD;
    }
}

Related

  1. dateToDateEN(String in)
  2. dateToFileName(String date)
  3. dateToInt(String date)
  4. dateToString(String date, String month)
  5. adjustDate(String format, String value)