N
N
NooBick2021-11-12 03:40:12
Node.js
NooBick, 2021-11-12 03:40:12

How to know the exact time?

I have a date, in this form: 2017-01-07T03:48:17+03:00

I need to find out how many years, months and days have passed since that moment.

If someone throws off the link to the manual on "Date", then already read. I didn't understand a single thing.

Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
veryoriginalnickname, 2021-11-12
@NooBick

const one = new Date().getTime()
const two = new Date('2017-01-07T03:48:17+03:00').getTime()
const ms = one - two
const sec = ms / 1000
const hours = sec / 3600
const days = hours / 24
// и так далее

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question