Android Date String Parse convertDateTime( String YearMonthDayHourMinuteSeconds)

Here you can find the source of convertDateTime( String YearMonthDayHourMinuteSeconds)

Description

convert Date Time

Declaration

@SuppressLint("SimpleDateFormat")
    public static String convertDateTime(
            String YearMonthDayHourMinuteSeconds) 

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 convertDateTime(
            String YearMonthDayHourMinuteSeconds) {
        String txtDate = "";
        String expectedPattern = "yyyy-MM-dd HH:mm:ss";
        SimpleDateFormat formatter = new SimpleDateFormat(expectedPattern);
        Date date;/*from  w  ww . j av a2s. c om*/
        try {
            date = formatter.parse(YearMonthDayHourMinuteSeconds);
            DateFormat df = new SimpleDateFormat("MMMM dd,yyyy @ HH:mm");
            txtDate = df.format(date);

        } catch (Exception e) {

        }

        return txtDate;
    }
}

Related

  1. parseDate(CharSequence input, Date defaultDate)
  2. parseDate(CharSequence input, String pattern, Date defaultDate)
  3. convertDate(String YearMonthDay)
  4. convertDateStringToDash(String MonthDayYear)
  5. convertDateStringToLong(String date, String format)
  6. convertToDate(String dateString)
  7. getDateFromString(String format, String dateString)
  8. getDateFromLJString( String dateString)
  9. getDateFromString(String dateString)