public static Date convertDate(Value value,Calendar calendar){
  if (value == ValueNull.INSTANCE) {
    return null;
  }
  ValueDate d=(ValueDate)value.convertTo(Value.DATE);
  Calendar cal=(Calendar)calendar.clone();
  cal.clear();
  cal.setLenient(true);
  long dateValue=d.getDateValue();
  setCalendarFields(cal,yearFromDateValue(dateValue),monthFromDateValue(dateValue),dayFromDateValue(dateValue),0,0,0,0);
  long ms=cal.getTimeInMillis();
  return new Date(ms);
}

public static Date convertDate ( Value value , Calendar calendar ) { if ( value == ValueNull . INSTANCE ) { return null ; } ValueDate d = ( ValueDate ) value . convertTo ( Value . DATE ) ; Calendar cal = ( Calendar ) calendar . clone ( ) ; cal . clear ( ) ; cal . setLenient ( true ) ; long dateValue = d . getDateValue ( ) ; setCalendarFields ( cal , yearFromDateValue ( dateValue ) , monthFromDateValue ( dateValue ) , dayFromDateValue ( dateValue ) , 0 , 0 , 0 , 0 ) ; long ms = cal . getTimeInMillis ( ) ; return new Date ( ms ) ; }
convert the date to the specified time zone .
