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

Declaration

public static Date stringToDate(String date) 

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 {
    public static Date stringToDate(String date) {
        Integer day = Integer.valueOf(date.split("/")[0]);
        String corectedDate = String.valueOf(day + 1) + "/" + date.split("/")[1] + "/" + date.split("/")[2];
        SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yyyy");
        Date fechaDate = null;//from  ww  w.  ja  va2 s.  c o m
        try {
            fechaDate = formato.parse(corectedDate);
        } catch (ParseException ex) {
        }
        return fechaDate;
    }
}

Related

  1. StringToDate(String data)
  2. stringToDate(String data)
  3. stringToDate(String date)
  4. stringToDate(String date)
  5. stringToDate(String date)
  6. stringToDate(String date)
  7. stringToDate(String date)
  8. StringToDate(String date)
  9. stringToDate(String date)