Android String to Date Convert convertStringToDate(String date)

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

Description

convert String To Date

Declaration

public static Date convertStringToDate(String date) 

Method Source Code

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

public class Main {
    public static Date convertStringToDate(String date) {
        Date result = null;//from w w w. j  a  va  2 s.co m
        SimpleDateFormat format = new SimpleDateFormat(
                "yyyy-MM-dd HH:mm:ss");

        try {
            result = format.parse(date);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return result;
    }
}

Related

  1. getDateFromString(String dateString)