Check if a date is 24 hours old

Created Example For One hour Refer This and Then Change it to 24 Hours

const OneHourAgo= (date) => {
    const hour= 1000 * 60 * 60;
    const hourago= Date.now() - hour;

    return date > hourago;
}

Simple One:-

var OneDay = new Date().getTime() + (1 * 24 * 60 * 60 * 1000)
                                     day hour  min  sec  msec
if (yourDate < OneDay) {
    // The yourDate time is less than 1 days from now
}
else if (yourDate >= OneDay) {
    // The yourDate time is exactly/more than 1 days from now
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)