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

Declaration

public static Date stringToDate(String dateString) 

Method Source Code


//package com.java2s;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static Date stringToDate(String dateString) {
        String sf = "yyyy-MM-dd HH:mm:ss";
        Date dt = stringToDate(dateString, sf);
        return dt;
    }/*from   w  w  w.j  a  v  a2  s  .  co m*/

    public static Date stringToDate(String dateString, String sf) {
        ParsePosition pos = new ParsePosition(0);
        SimpleDateFormat sdf = new SimpleDateFormat(sf);
        Date dt = sdf.parse(dateString, pos);
        return dt;
    }
}

Related

  1. stringToDate(String dateStr, SimpleDateFormat dateFormat)
  2. StringtoDate(String dateStr, String format)
  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)