Here you can find the source of convertStringToDateTimeNotException(String date)
public static Date convertStringToDateTimeNotException(String date)
//package com.java2s; /*/*from w ww . j a v a 2s . c o m*/ * Copyright (C) 2010 dungnv. All rights reserved. * VIETTEL PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date convertStringToDateTimeNotException(String date) { String pattern = "dd/MM/yyyy HH:mm:ss"; try { return convertStringToTime(date, pattern); } catch (Exception e) { return null; } } /** * * @param date to convert * @param pattern in converting * @return date */ public static Date convertStringToTime(String date, String pattern) throws Exception { SimpleDateFormat dateFormat = new SimpleDateFormat(pattern); try { return dateFormat.parse(date); } catch (ParseException e) { System.out.println("Date ParseException, string value:" + date); throw e; } } }