Download this file

DateUtilityMethods.java    25 lines (20 with data), 540 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package eu.alfred.recommendations.util;
import java.time.Instant;
import java.time.LocalDate;
import java.time.ZoneOffset;
/**
* This class provides some utility methods related to date and time.
*
* @author tasos
*
*/
public class DateUtilityMethods {
public Long getCurrentDate() {
return Instant.now().toEpochMilli();
}
public Long getDateInTwoWeeks() {
LocalDate today = LocalDate.now();
LocalDate inTwoWeeks = today.plusWeeks(2);
return inTwoWeeks.atStartOfDay().toInstant(ZoneOffset.UTC).toEpochMilli();
}
}