1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-12-10 06:11:08 +01:00

Introduce and use DateUtil.toSecondsPrecision

This commit is contained in:
Paul Schaub 2021-12-28 01:35:12 +01:00
parent 2f44621657
commit f3b7286eaf
3 changed files with 12 additions and 2 deletions

View file

@ -45,6 +45,16 @@ public final class DateUtil {
return getParser().format(date);
}
/**
* "Round" a date down to seconds precision.
* @param date
* @return
*/
public static Date toSecondsPrecision(Date date) {
long seconds = date.getTime() / 1000;
return new Date(seconds * 1000);
}
/**
* Return the current date "rounded" to UTC precision.
*