Here you can find the source of parseDate(String exifDate)
public static Date parseDate(String exifDate)
//package com.java2s; //License from project: Apache License import java.sql.Timestamp; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date parseDate(String exifDate) { if (exifDate == null) { return null; }//from w w w .j av a2 s.c o m String patterns[]; int i; patterns = (new String[] { "yyyy:MM:dd HH:mm:ss", "yyyy:MM:dd HH:mm", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "dd.MM.yy HH:mm", "yyyyMMdd HHmmss", "yyyyMMdd.HHmmss", "yyyyMMdd HHmm", "MM/dd/yy hh:mm a", "HH:mm:ss dd.MM.yyyy", "yyyy:MM:dd", "yyyy-MM-dd", "dd.MM.yy", "yyyyMMdd", "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "MM/dd/yy", "yyyy:MM:dd HH:mm:sss" }); for (i = 0; i < patterns.length; i++) { try { DateFormat parser = new SimpleDateFormat(patterns[i]); return parser.parse(exifDate); } catch (ParseException ex) { } } return null; } public static Date parseDate(String date, String pattern) { if (date == null) return null; try { DateFormat parser = new SimpleDateFormat(pattern); return parser.parse(date); } catch (ParseException ex) { } return null; } public static String parseDate(Timestamp timestamp, String pattern) { if (timestamp == null) return null; DateFormat parser = new SimpleDateFormat(pattern); return parser.format(timestamp); } }