0

I would like to know how many seconds are in a certain range. For example, the start timestamp would be: 08/25/2022 16:55:29 For example, the end timestamp would be 08/25/2022 19:42:21

Now I want to know how many seconds I was between 6pm and 11pm. In the example above, 6141 seconds should come out.

i dont want to get the difference between the two areas. I want to get how many seconds of my area are in another area

How do I do that in Node.js?

Edit: Okay, I'll try to explain it again with an example:

An employee logs in at 4:55:29pm and finishes work at 7:42:21pm.

The company has set a range where you earn more per second. This area is between 6pm and 11pm.

Now I want to know how many seconds the employee is in this range.

  • Convert date to unix timestamp and then do `$diff = $toTimestamp - $fromTimestamp` – Justinas Aug 25 '22 at 14:42
  • Okay, I'll try to explain it again with an example: An employee logs in at 4:55:29pm and finishes work at 7:42:21pm. The company has set a range where you earn more per second. This area is between 6pm and 11pm. Now I want to know how many seconds the employee is in this range. – Silvio-Raini Aug 25 '22 at 14:58
  • Closed now, but this question has absolutely nothing to do with node.js or discord.js. – Joe Moore Aug 25 '22 at 16:07
  • @Silvio-Raini Calculate diff between `4:55:29pm` and `6:00:00pm`, then difference between `6:00:00pm` and `7:42:21pm` – Justinas Aug 26 '22 at 06:42

0 Answers0