Java String to Date stringToDate(String data)

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

Description

string To Date

License

Open Source License

Declaration

public static Date stringToDate(String data) 

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 {
    private static SimpleDateFormat format = new SimpleDateFormat(
            "dd/MM/yyyy");

    public static Date stringToDate(String data) {
        Date retorno = new Date();
        ;//from  w ww.  j a v a2s .c o m

        if (data != null && !data.equalsIgnoreCase("")) {
            try {
                retorno = format.parse(data);
            } catch (ParseException e) {
                e.printStackTrace();
            }
        } else {
            retorno = null;
        }

        return retorno;
    }
}

Related

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