Android Date String to Date Convert changeStringToDate3(String str)

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

Description

change String To Date

Declaration

public static String changeStringToDate3(String str) 

Method Source Code

//package com.java2s;
import java.sql.Timestamp;

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

public class Main {

    public static String changeStringToDate3(String str) {

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        java.util.Date date6 = null;
        try {/* w ww.j  a v  a2 s .c om*/
            date6 = sdf.parse(str);
            java.sql.Date date7 = new java.sql.Date(date6.getTime());
            Timestamp stamp9 = new Timestamp(date7.getTime());
            return stamp9.toString();
        } catch (ParseException e) {
            e.printStackTrace();
            return "";
        }
    }
}

Related

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