Java 8 expiration after a duration -


can't figure out how in java 8 (without calendar) simple method:

 import java.time.duration;  import java.util.date;   [...] /**  * true if date + duration before now()  * @param date   * @param d  * @return  */ public static boolean isdateexpired (date date, duration d) {  // how ? } 

consider getting rid of java.util.date. when must deal due legacy code, escape java.time equivalent , operate there:

return date.toinstant().plus(d).isbefore(instant.now()); 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -