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:
parent
2f44621657
commit
f3b7286eaf
3 changed files with 12 additions and 2 deletions
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue