public java . util . Date getDateWithDefaultZone ( ) { LocalDate pickerDate = parentDatePicker . getDate ( ) ; if ( pickerDate == null ) { return null ; } Instant instant = pickerDate . atStartOfDay ( ZoneId . systemDefault ( ) ) . toInstant ( ) ; // for backport: java.util.Date javaUtilDate = DateTimeUtils.toDate(instant); // for java.time: java.util.Date javaUtilDate = java.util.Date.from(instant); // This function was created to be compatible with both libraries. java . util . Date javaUtilDate = getJavaUtilDateFromInstant ( instant ) ; return javaUtilDate ; }
getDateWithDefaultZone Returns the date picker value as a java . util . Date that was created using the system default time zone or returns null . This will return null when the date picker has no value .