I want to get following date format (by JavaScript only) - March 3, 2020
var date = new Date(); console.log(date);
Currently I am getting in " 2020-05-11T10:08:43.322Z " format. Kindly, help!
You can check Date.prototype.toLocaleString for more information
var date = new Date(); console.log(date.toLocaleString('en-US', {month: 'long', day: 'numeric', year: 'numeric'}));
You can use moment.js
let date = moment().format('MMMM DD, YYYY'); console.log(date)
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.19.1/moment.min.js" integrity="sha256-zG8v+NWiZxmjNi+CvUYnZwKtHzFtdO8cAKUIdB8+U9I=" crossorigin="anonymous"></script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.