Seconds in a Day

Number of seconds in a day.

Usage

var SECONDS_IN_DAY = require( '@stdlib/constants/time/seconds-in-day' );

SECONDS_IN_DAY

Number of seconds in a day.

var bool = ( SECONDS_IN_DAY === 86400 );
// returns true

Notes

  • The value is a generalization and does not take into account inaccuracies due to daylight savings conventions, crossing timezones, or other complications with time and dates.

Examples

var randu = require( '@stdlib/random/base/randu' );
var roundn = require( '@stdlib/math/base/special/roundn' );
var SECONDS_IN_DAY = require( '@stdlib/constants/time/seconds-in-day' );

var days;
var secs;
var i;

function days2secs( days ) {
    return days * SECONDS_IN_DAY;
}

for ( i = 0; i < 10; i++ ) {
    days = roundn( randu()*20.0, -2 );
    secs = days2secs( days );
    console.log( '%d days => %d seconds', days, secs );
}
Did you find this page helpful?