If following data represent date and time respectively:
date: 2023-04-04
time: 13:02:00.963+00:00
How do I combine above date and time using dayjs, so it looks as below format:
2023-04-04T13:02:00.963Z
Is there any built-in method to do this? and what’re the alternatives?
Thank you
2
Answers
you can use the inbuilt
Date.toISOString
for this in case you are wonderingor using dayjs
or using moment
or using luxon
To combine a date and time using Day.js, you can use the .set() method to set the time part of the date to the desired time value. Here is an example: