code: public static java.sql.Date truncateToSqlDate(long time) {
          Calendar calendar = THREADLOCAL_CAL_DEFAULT.get();
          calendar.setTimeInMillis(time);
          calendar.set(Calendar.HOUR_OF_DAY, 0);
          calendar.set(Calendar.MINUTE, 0);
          calendar.set(Calendar.SECOND, 0);
          calendar.set(Calendar.MILLISECOND, 0);
          return new java.sql.Date(calendar.getTimeInMillis());
      }
docs: This method will truncate hours, minutes, seconds and milliseconds to zeros, to conform with JDBC spec:
  <a href="http://download.oracle.com/javase/6/docs/api/java/sql/Date.html">http://download.oracle.com/javase/6/docs/api/java/sql/Date.html</a>.
  
  @param time time in UTC milliseconds from the epoch
  @return java.sql.Date instance representing time value