Android Date String to Date Convert changeStringToDate2(String str)

Here you can find the source of changeStringToDate2(String str)

Description

change String To Date

Declaration

public static String changeStringToDate2(String str) 

Method Source Code

//package com.java2s;

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

public class Main {

    public static String changeStringToDate2(String str) {

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        java.util.Date date6 = null;
        try {/*from  w w  w .  ja v a  2s  .c o  m*/
            date6 = sdf.parse(str);
            java.sql.Date date7 = new java.sql.Date(date6.getTime());
            return date7.toString();
        } catch (ParseException e) {
            e.printStackTrace();
            return "";
        }
    }
}

Related

  1. removeTimeZone(String data)
  2. parseFileName(String timeStr)
  3. formatDate(String date)
  4. changeStringToDate(String fecha, String pattern)
  5. changeStringToDate1(String str)
  6. changeStringToDate3(String str)
  7. convertDateStringToDate(String dateString)
  8. string2Date(String s, String s1)
  9. stringToDate(SimpleDateFormat dateFormat, String dateToConvert, boolean catchError)