Java String to Time str2DateTime(String strDate)

Here you can find the source of str2DateTime(String strDate)

Description

yyyy-MM-dd HH:mm:ss

License

Open Source License

Declaration

public static Date str2DateTime(String strDate) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.text.DateFormat;
import java.text.ParseException;

import java.util.Date;

public class Main {
    /** yyyy-MM-dd HH:mm:ss **/
    public static Date str2DateTime(String strDate) {

        DateFormat df = DateFormat.getDateTimeInstance();
        Date date = null;//from  w  w w  .j a v a2 s  .  c o  m
        try {
            date = df.parse(strDate);
        } catch (ParseException e) {
            e.printStackTrace();
        }

        return date;
    }
}

Related

  1. getTime(String time)
  2. getTime(String time)
  3. getTimeDate(String time)
  4. getTimes(String startTime, String endTime)
  5. replaceDateTime(String input)
  6. string2Date(String time)
  7. string2DateTime(String stringDate)
  8. string2DateTimeByAutoZero(String stringDate)
  9. stringToCalendar(String stringTime)