Could someone explain to me what this returning number means? and how it is derived to that?
console.log(Date.now() - 24 * 60 * 60 * 1000);
If I wanted to use the above formula to display the next 15minutes and not 24 hours? how would I alter it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Date.now()returns:24 * 60 * 60 * 1000in milliseconds represents 24 hours*. So you basically get a timestamp 24 hours in the past from now. Notice that due to DST this doesn’t necessarily compute a timestamp one day in the past. It’s 24 hours in the past.Also to get some meaningful output you should wrap resulting number in
Date:Finally
Date.now()can be replaced withnew Date()when using in arithmetic expression.* – 24 (hours) times 60 (minutes in hour) times 60 (seconds in minute) times 1000 milliseconds in second.