Java yyyy formatDate(String inputDate)

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

Description

format Date

License

Open Source License

Declaration

public static String formatDate(String inputDate) throws ParseException 

Method Source Code


//package com.java2s;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    private static final String inputDateFormat = "yyyy-MM-dd";
    private static final String outputDateFormat = "dd/MM/yyyy";

    public static String formatDate(String inputDate) throws ParseException {
        // formatting date in Java using SimpleDateFormat
        SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(inputDateFormat);
        Date d = DATE_FORMAT.parse(inputDate);
        DATE_FORMAT.applyPattern(outputDateFormat);
        return DATE_FORMAT.format(d);
    }//from w  ww . j  a v  a 2 s. c  o  m
}

Related

  1. formatDate(DateTime aDateTime)
  2. formatDate(final Date date, final String defaultValue)
  3. formatDate(String date)
  4. formatDate(String date)
  5. formatDate(String date)
  6. formatDate2DateStr()
  7. formatDate2DateStr()
  8. formatDate2ShortStr(Date date)
  9. formatDate2Str(Date date)