Java Date Parse convertStrToDate(String source)

Here you can find the source of convertStrToDate(String source)

Description

convert Str To Date

License

Apache License

Declaration


public static Date convertStrToDate(String source) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static Date convertStrToDate(String source) {
        Date date = null;/*from  w  w  w . j  av a2 s .  c  o  m*/
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        sdf.setLenient(false);
        try {
            date = sdf.parse(source);
        } catch (ParseException e) {
        }

        return date;
    }
}

Related

  1. convertStringToTime(String date, String pattern)
  2. convertStringToTime(String date, String pattern)
  3. convertStrToDate(String dateStr, String dateFormat)
  4. convertStrToDate(String day)
  5. convertStrToDate(String s, String format)
  6. convertTFormatToCDATime(String tDate)
  7. convertTimeInMillisecondsToDate(long timeInMilliseconds)
  8. convertTimeStampToDate(String dateString, String srcFormat, String destFormat)
  9. convertTimestampToDateTime(Long timestamp, Boolean withSeconds)