If you want to get Day, Month and Year separate then you can use the following code.
- YYYY represents the year.
- MM represents the month.
- DD represents the day.
- THH represents the hour.
- mm represents the minute.
- ss represents the second.
- sss represents the milliseconds.
- Z represents the UTC time zone.
The toISOString() method produces a standardized string representation that's commonly used for data interchange and storage across different systems.
Detailed date format
You can try this detailed date format like day name , month name etc.
Finally, you can use a single line code using JSON for getting the current date.
Moreover, you can use Date.js library which extends Date object , thus you can have .today() method.