I want to get the difference between days, but there is time and other information attached with this date format. 2021-04-05T19:12:33.000Z
How do we eliminate all the other time and just get the year, month, day fields to find the difference between days?
AKA How do you convert 2021-04-05T19:12:33.000Z
to
just the year, month day and no seconds? 2021-04-05T00:00:00.000Z
or just get
2021-04-05? Or any other format to get the difference between 2 days and not considering the timestamps?
I'm thinking of extracting the year, month and day from the string and set it as fields. Then pass it into
const year = ("2021-04-05T19:12:33.000Z").substring(0,4)
const month .. etc
new Date('05/04/2021') manually, but is there a better way to extract month, day, year from 2021-04-05T19:12:33.000Z ? Then find the days difference?
Thank you!