I want to generate this date format using Moment.js:
Mon Apr 1 17:51:40 2019
Right now, I am getting this format instead:
Mon Apr 01 2019 17:51:40 GMT+0530 (IST)
I want to generate this date format using Moment.js:
Mon Apr 1 17:51:40 2019
Right now, I am getting this format instead:
Mon Apr 01 2019 17:51:40 GMT+0530 (IST)
 
    
     
    
    use this:
Moment(new Date(this.state.date)).format('MMMM Do YYYY, h:mm:ss a')
or whatever format you want. you can check them on here: https://momentjs.com/
 
    
    Try this:
 var dateTime = new Date("Mon Apr 01 2019 17:51:40 GMT+0530 (IST)");
 dateTime = moment(dateTime).format("ddd MMM D HH:mm:ss YYYY");
 
    
    It's already a valid date string - just make a new Date:
console.log(new Date("Mon Apr 01 2019 17:51:40 GMT+0530 (IST)")); 
    
    first you need to install moment
 let formatedDate = moment('Mon Apr 01 2019 17:51:40 GMT+0530 (IST)').format('ddd MMM DD HH:mm:ss YYYY');
 console.log(formatedDate)
output: Mon Apr 01 17:51:40 2019
Done You can check it
