Advertisement
728x90
You can use the Intl.DateTimeFormat object which is a constructor for objects that enable language-sensitive date and time formatting. Let's see this behavior with an example,
javascript
1var date = new Date(Date.UTC(2019, 07, 07, 3, 0, 0));
2
3console.log(new Intl.DateTimeFormat("en-GB").format(date)); // 07/08/2019
4
5console.log(new Intl.DateTimeFormat("en-AU").format(date)); // 07/08/2019Advertisement
Responsive Ad
🎯 Practice NowRelated Challenge
JavaScript Coding Exercise 63
Test your knowledge with this interactive coding challenge.
Start CodingAdvertisement
728x90
234of476