Java yyyy formatDate(String date)

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

Description

format Date

License

LGPL

Declaration

public static Date formatDate(String date) throws Exception 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public final static String DATE_FORMAT = "yyyy-MM-dd";

    public static Date formatDate(String date) throws Exception {

        DateFormat myDateFormat = new SimpleDateFormat(DATE_FORMAT);
        return myDateFormat.parse(date);
    }//from   ww w  . j  a  v a2  s .co  m
}

Related

  1. formatDate(Date inputDate, String formatPattern)
  2. formatDate(Date unformattedDate, String format)
  3. formatDate(DateTime aDateTime)
  4. formatDate(final Date date, final String defaultValue)
  5. formatDate(String date)
  6. formatDate(String date)
  7. formatDate(String inputDate)
  8. formatDate2DateStr()
  9. formatDate2DateStr()