Java String to Date stringToDate(String date)

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

Description

String to date.

License

Open Source License

Parameter

Parameter Description
date the date

Return

the date

Declaration

public static Date stringToDate(String date) 

Method Source Code


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

public class Main {
    /**/*w  ww .  j  a  v a2 s  .  com*/
     * String to date.
     * 
     * @param date
     *            the date
     * @return the date
     */
    public static Date stringToDate(String date) {
        Date formattedDate = null;
        try {
            SimpleDateFormat sd = new SimpleDateFormat("dd/MM/yyyy");
            formattedDate = sd.parse(date);
        } catch (ParseException e) {
            System.out.println("<<<<error >>>>" + e.getMessage());
            e.printStackTrace();
        }
        return formattedDate;
    }
}

Related

  1. stringToDate(final String str, final String dateFormat)
  2. stringToDate(final String string, final String format)
  3. StringToDate(String data)
  4. stringToDate(String data)
  5. stringToDate(String date)
  6. stringToDate(String date)
  7. stringToDate(String date)
  8. stringToDate(String date)
  9. stringToDate(String date)