Java Date String Format formatDate(String date)

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

Description

format Date

License

Open Source License

Declaration

public static String formatDate(String date) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String formatDate(String date) {

        int i = date.indexOf(";");

        String[] tokens = date.substring(0, i).split("[ -/]");

        if (tokens.length == 1)
            return tokens[0];

        if (tokens.length == 2)
            return tokens[0] + "-" + tokens[1];

        return tokens[0] + "-" + tokens[1] + "-" + tokens[2];

    }/* ww w .  j  a v  a2 s.  co  m*/
}

Related

  1. formatDate(Integer date)
  2. formatDate(Integer day, Integer month, Integer year)
  3. FormatDate(String aDate)
  4. formatDate(String date)
  5. formatDate(String date)
  6. formatDate(String date)
  7. formatDate(String date, int format)
  8. formatDate(String dateString, String delimiter)
  9. formatDate(String fieldName)