Java String to Date stringToDate(String dateString)

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

Description

String to date.

License

Open Source License

Parameter

Parameter Description
dateString the date string

Return

the date

Declaration

public static Date stringToDate(String dateString) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    /**/*from www  .j  a va 2s  .  c om*/
     * String to date.
     * 
     * @param dateString
     *              the date string
     * @return the date
     */
    public static Date stringToDate(String dateString) {
        Date date;
        if (!dateString.equalsIgnoreCase("")) {
            try {
                date = new SimpleDateFormat("dd MMM yyyy").parse(dateString);
                return date;
            } catch (ParseException e) {

            }
        }
        return null;
    }
}

Related

  1. StringtoDate(String dateStr, String format)
  2. stringToDate(String dateString)
  3. stringToDate(String dateString)
  4. stringToDate(String dateString)
  5. stringToDate(String dateString)
  6. stringToDate(String dateString)
  7. stringToDate(String dateString)
  8. stringToDate(String dateString)
  9. stringToDate(String dateString, String dataFormat)