Android Date String to Date Convert formatToDate(String date)

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

Description

format To Date

Declaration

public static final String formatToDate(String date) 

Method Source Code

//package com.java2s;

public class Main {
    public static final String formatToDate(String date) {
        if (date == null) {
            return "";
        } else {//w w w  .  j a v a 2 s  .  c o  m
            int index = date.indexOf(" ");
            return (index > 0 ? date.substring(0, index) : date)
                    .replaceAll("/", "-");
        }
    }
}

Related

  1. ParseDate(String str)
  2. ParseUTCDate(String str)
  3. fromStringFR(String dateString)
  4. fromStringUS(String dateString)
  5. getDateFromString(String dateString, String dateFormat)
  6. getDefaultDateTimeString(String date, Locale locale)