return new Timestamp(System.currentTimeMillis()).toString().substring(0, 10);
Timestamp ts = null; try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String d = sdf.format(new java.util.Date()); ts = Timestamp.valueOf(d); } catch (Exception ex) { ex.printStackTrace(); return ts.toString().substring(8, 10);
Timestamp ts = getCurrentTimestamp(); SimpleDateFormat format = new SimpleDateFormat("MM/dd/yy"); return format.format(ts);
LocalDate localDate = getNowLocalDate();
return toDate(localDate);
Get Date from Calendar.
java.util.Date date = pCal.getTime(); return new java.sql.Date(date.getTime());
Calendar cal = Calendar.getInstance(); cal.setTime(date); return new java.sql.Date(cal.getTimeInMillis());