Semantically, you’re probably looking for the one-liner
new Date().toLocaleString()
which formats the date in the locale of the user.
If you’re really looking for a specific way to format dates, I recommend the moment.js library.
More Related Contents:
- How to sort an object array by date property?
- How do you display JavaScript datetime in 12 hour AM/PM format?
- How to add hours to a Date object?
- Display date/time in user’s locale format and time offset
- Compare two dates with JavaScript
- new Date() is working in Chrome but not Firefox
- Parsing ISO 8601 date in Javascript
- How to get the day of week and the month of the year?
- Get Locale Short Date Format using javascript
- How can I calculate the number of years between two dates?
- Javascript format date / time [duplicate]
- Javascript Date.UTC() function is off by a month?
- How do I get the current time only in JavaScript
- javascript Date timezone issue
- JSON Stringify changes time of date because of UTC
- How to get the exact local time of client?
- Convert normal date to unix timestamp
- How to get the current date or/and time in seconds
- Safari JS cannot parse YYYY-MM-DD date format?
- Get next date from weekday in JavaScript
- Firestore Timestamp.fromDate not UTC
- Regex and ISO8601 formatted DateTime [duplicate]
- Compute elapsed time [duplicate]
- How do I get a timestamp in JavaScript?
- Date.toISOString() but local time instead of UTC
- Parsing Date from webservice
- create javascript date UTC
- Javascript, Time and Date: Getting the current minute, hour, day, week, month, year of a given millisecond time
- Hot to get incomplete datetime-local input values
- Converting Google spreadsheet date into a JS Date object?