String string_Date = "2014-06-11"; //my string date
SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy-MM-dd");
// Date startTimestam = simpleFormat.parse(string_Date);
Timestamp startTimestam = Timestamp.valueOf(string_Date);
Calendar cal = Calendar.getInstance();
cal.setTime(startTimestam);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 1);
starTimeStamp = new Timestamp(cal.getTime().getTime());
// will get output date is "2014-06-11 00:00:01"
- here I don't want use simple Format for converting string to date or timestamp,
- if above code run I will get exception is
illegalArgumentException
i.e.Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]**
- is it possible with out format converts string date.
- if possible very helpfully for me.