Avatar ·

How to properly format date and time in JavaScript? No built-in method?

Hello everyone! I just started learning JavaScript and encountered a problem with date formatting. I need to output the current date in the format "DD.MM.YYYY HH:MM", but I can't find a built-in method that does this. Here's what I tried: ```javascript const now = new Date(); console.log(now); // Outputs something like "Fri Jan 12 2024 15:30:45 GMT+0300" ``` I need exactly the Russian format with dots and two-digit numbers. I know there are methods like `.getDate()`, `.getMonth()`, etc., but they return numbers without leading zeros. For example, January 5th shows "5" instead of "05". And the month starts from 0, so January is 0, not 1. This is very inconvenient! I've heard about libraries like moment.js, but it seems strange to include an entire library just for date formatting. Is there really no way in modern