Android Date String to Date Convert formatDate(String date)

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

Description

format Date

Declaration

public static String formatDate(String date) 

Method Source Code

//package com.java2s;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static final String INPUT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";

    public static String formatDate(String date) {
        SimpleDateFormat input = new SimpleDateFormat(INPUT_DATE_FORMAT);
        SimpleDateFormat output = new SimpleDateFormat(
                "dd/MM/yyyy HH::mm:ss");
        Date d;/*from w  ww  .  j a v  a2 s. c  om*/
        try {
            d = input.parse(date);
            return output.format(d);
        } catch (ParseException e) {
            e.printStackTrace();
            return "";
        }

    }
}

Related

  1. getDateOffset(String date, int offset)
  2. getDateTomorrow(String date)
  3. convertStandardDateTime(String time)
  4. removeTimeZone(String data)
  5. parseFileName(String timeStr)
  6. changeStringToDate(String fecha, String pattern)
  7. changeStringToDate1(String str)
  8. changeStringToDate2(String str)
  9. changeStringToDate3(String str)