Java Parse Date parseDateTime(String currDate, String format)

Here you can find the source of parseDateTime(String currDate, String format)

Description

parse Date Time

License

Apache License

Declaration

public static Date parseDateTime(String currDate, String format) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static Date parseDateTime(String currDate, String format) {
        SimpleDateFormat dtFormatdB = null;
        try {/*from   w  w  w .ja  v  a 2s .c o  m*/
            dtFormatdB = new SimpleDateFormat(format);
            return dtFormatdB.parse(currDate);
        } catch (Exception e) {
            dtFormatdB = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            try {
                return dtFormatdB.parse(currDate);
            } catch (Exception ex) {
            }
        }
        return null;
    }
}

Related

  1. parseDateStrShort(String date)
  2. parseDateSubset(String value, String[] parsePatterns, Locale l, TimeZone tz)
  3. parseDateTime(@Nullable String s)
  4. parseDateTime(final String dateTime)
  5. parseDateTime(String _date)
  6. parseDateTime(String d, String t)
  7. parseDateTime(String date)
  8. parseDateTime(String date, String format, String locale, String timeZone)
  9. parseDateTime(String date, String time)