Android Date String Parse convertDate(String YearMonthDay)

Here you can find the source of convertDate(String YearMonthDay)

Description

convert Date

Declaration

@SuppressLint("SimpleDateFormat")
    public static String convertDate(String YearMonthDay) 

Method Source Code

//package com.java2s;
import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.util.Date;
import android.annotation.SuppressLint;

public class Main {
    @SuppressLint("SimpleDateFormat")
    public static String convertDate(String YearMonthDay) {
        String txtDate = "";
        String expectedPattern = "yyyy-MM-dd";
        SimpleDateFormat formatter = new SimpleDateFormat(expectedPattern);
        Date date;/*from   w  w  w  .j a  va2 s  . co  m*/
        try {
            date = formatter.parse(YearMonthDay);
            DateFormat df = new SimpleDateFormat("MMMM dd,yyyy");
            txtDate = df.format(date);

        } catch (Exception e) {

        }

        return txtDate;
    }
}

Related

  1. toDate(String sdate)
  2. toDateFormat(String d, String delim)
  3. parseDate(CharSequence input)
  4. parseDate(CharSequence input, Date defaultDate)
  5. parseDate(CharSequence input, String pattern, Date defaultDate)
  6. convertDateStringToDash(String MonthDayYear)
  7. convertDateStringToLong(String date, String format)
  8. convertDateTime( String YearMonthDayHourMinuteSeconds)
  9. convertToDate(String dateString)