Replace java.util.Date and java.util.Calendar with java.time.* equivalents.

This commit is contained in:
Tim Donohue
2025-01-13 11:02:28 -06:00
parent 1052915360
commit 611e98afe8
299 changed files with 2065 additions and 2752 deletions

View File

@@ -8,7 +8,9 @@
package org.dspace.embargo;
import java.sql.SQLException;
import java.util.Date;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Properties;
import org.dspace.authorize.AuthorizeException;
@@ -61,9 +63,9 @@ public class DayTableEmbargoSetter extends DefaultEmbargoSetter {
}
String days = termProps.getProperty(terms);
if (days != null && days.length() > 0) {
long lift = System.currentTimeMillis() +
long lift = Instant.now().toEpochMilli() +
(Long.parseLong(days) * 24 * 60 * 60 * 1000);
return new DCDate(new Date(lift));
return new DCDate(LocalDateTime.ofEpochSecond(lift, 0, ZoneOffset.UTC));
}
}
return null;