public Date getExpirationDateAsDate ( ) { if ( hasExpirationDate ( ) ) { final LocalDateTime endOfMonth = expirationDate . atEndOfMonth ( ) . atStartOfDay ( ) . plus ( 1 , ChronoUnit . DAYS ) . minus ( 1 , ChronoUnit . NANOS ) ; final Instant instant = endOfMonth . atZone ( ZoneId . systemDefault ( ) ) . toInstant ( ) ; final Date date = new Date ( instant . toEpochMilli ( ) ) ; return date ; } else { return null ; } }
Gets the card expiration date as a java . util . Date object . Returns null if no date is available .