public static Date roundDate(Date date, int seconds) {
        return new Date(roundDate(date.getTime(), seconds));
    }
Rounds the given date down to the nearest specified second. The following
table shows sample input and expected output values: (Note, only
the time portion of the date is shown for brevity)

<table border="1">
<caption>Rounding examples</caption>
<tr><th>Date</th><th>Seconds</th><th>Result</th></tr>
<tr><td>1:37.48</td><td>5</td><td>1:37.45</td></tr>
<tr><td>1:37.48</td><td>10</td><td>1:37.40</td></tr>
<tr><td>1:37.48</td><td>30</td><td>1:37.30</td></tr>
<tr><td>1:37.48</td><td>60</td><td>1:37.00</td></tr>
<tr><td>1:37.48</td><td>120</td><td>1:36.00</td></tr>
</table>

<p>This method is useful when calculating the last post in
a forum or the number of new messages from a given date. Using a rounded
date allows Jive to internally cache the results of the date query.
Here's an example that shows the last posted message in a forum accurate
to the last 60 seconds:</p>

<pre>
SessionResultFilter filter = new SessionResultFilter();
filter.setSortOrder(SessionResultFilter.DESCENDING);
filter.setSortField(JiveGlobals.SORT_CREATION_DATE);
<b>filter.setCreationDateRangeMin(SessionResultFilter.roundDate(forum.getModificationDate(), 60));</b>
filter.setNumResults(1);
Iterator messages = forum.messages(filter);
ForumMessage lastPost = (ForumMessage)messages.next();
</pre>

@param date the {@code Date} we want to round.
@param seconds the number of seconds we want to round the date to.
@return the given date, rounded down to the nearest specified number of seconds.
xmppserver/src/main/java/org/jivesoftware/openfire/SessionResultFilter.java