The Be Sure Blog

Code Snippets | Problem Solving | Tips & Tricks

The Be Sure Blog banner

Convert a date to (German date layout)

posted on 10.12.2022 by Below Surface in "JavaScript"

Your date may currently look like:


All you need to convert it to the german format ( is:

const yourDate = "2022-10-25";
const convertedDate = new Date(yourDate).toLocaleString('de-DE').split(",")[0];

The new Date() method converts your date from string to date format and then converts it to the german format with the .toLocateString('de-DE') method. The .split() method is added to only take the part before the comma and time, that would be included. Your output should now look like:



string method

More posts of this category

How to sort an array by string value

One way to sort an array alphabetically by a string value