Comparing Times 24 Hour Intervals
<p>I have 2 timestamps in JavaScript. One timestamp comes from an Ajax call to my database and the other is generated when the script it loaded.</p>

<p>What I want to do is check to see if the timestamp from the database is older than 24 hours compared the timestamp that was just generated.</p>

<p>In my case the database timestamp is always going to be lesser than the current timestamp.</p>

<p>Would this work?</p>

<pre><code>var currentTimestamp = Math.round(new Date().getTime() / 1000);
if((currentTimestamp - databaseTimestamp) &gt;= 86400) {
    // Older than 24 hours
} else {
    // Less than 24 hours
}
</code></pre>

<p>... or is there a better way?</p>
