Java String to Date toDate(String formatDate, String stringDate)

Here you can find the source of toDate(String formatDate, String stringDate)

Description

to Date

License

Open Source License

Declaration

public static Date toDate(String formatDate, String stringDate) throws ParseException 

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 toDate(String formatDate, String stringDate) throws ParseException {
        if (stringDate == null || stringDate.isEmpty()) {
            return null;
        }//from w  ww .j  a v a  2s  .  c  o  m
        SimpleDateFormat format = new SimpleDateFormat(formatDate);
        return format.parse(stringDate);
    }
}

Related

  1. toDate(String datetime)
  2. toDate(String dateToConvert)
  3. toDate(String dateToDatify)
  4. toDate(String dateValue, String format)
  5. toDate(String format, String str)
  6. toDate(String param)
  7. toDate(String patten, String value)
  8. toDate(String pattern, String date)
  9. toDate(String pString, String pFormat)