Date formatting in JavaScript: where to find documentation and how to do it correctly?
Hi everyone! I'm a beginner in JavaScript and I can't figure out date formatting. I need to output the current date in the format "DD.MM.YYYY", but I can't find clear documentation on this topic.\n\nHere's what I tried:\n\n```javascript\nlet date = new Date();\nconsole.log(date); // Outputs something like "Fri Dec 20 2024 14:30:00 GMT+0300"\n```\n\nBut I need to get exactly "20.12.2024". I know that in other languages (e.g., Java) there is `SimpleDateFormat` or `DateTimeFormatter` where you can specify a pattern. In JavaScript, I only found `toLocaleDateString()`, but it outputs the date in a format that depends on the browser locale, and I can't control the order of day, month, and year.\n\nWhere can I find documentation on working with dates? I looked at MDN, but it only describes basic methods like `get
No answers yet.
Log in to leave an answer