How can I create a folder or file with the current date and time and in a specific directory?
DateTimeFormatter f = DateTimeFormatter.ofPattern("uuuuMMdd HHmmss") ;
LocalDateTime ldtFile = LocalDateTime.parse(fileName, f) ;
ZoneId z = ZoneId.of("Asia/Tokyo") ;
ZonedDateTime zdtNow = ZonedDateTime.now(z) ;
LocalDateTime ldtThreeDaysAgo = zdtNow.minusDays(3).toLocalDateTime() ;
if(ldtFile.isAfter(ldtThreeDaysAgo))
{
....
}
I tried this example but it didn’t work for me as it is for Java 8+.