I would like to convert a Javascript Date (as in const currentDate = new Date();
) to the format below:
YYYY-MM-DDTHH:MM:SS+00:00
(I know the timezone will depend on the timezone I am).
But I need the timezone in this format: +HH:00
or -HH:00
. I guess the minutes for a timezone will always be zero (but maybe there are some half timezones somewhere).
Anyway, the snippet below for the current date gives me this result:
2019-11-20T18:02:57.568Z
Is there an automated way to do that conversion? Or maybe an npm package.
const currentDate = new Date();
console.log(currentDate.toISOString());