首页 > 解决方案 > How can I convert my date "Wed Jan 01 2020 00:00:00 GMT+0530 (India Standard Time) " to JAN 01,2020 using JavaScript?

问题描述

Currently I am getting my date from data base in the format of Wed Jan 01 2020 00:00:00 GMT+0530 (India Standard Time) but I want the date in JAN O1,2020 format and I don't want to use mon=ment.js for this. any other ways to achieve this?

标签: javascriptjquerymongodbexpress

解决方案


Here is a solution without moment.js

var n = new Date("Wed Jan 01 2020 00:00:00 GMT+0530 (India Standard Time)");
var options = {
  month: "short",
  day: "numeric",    
  year: "numeric",
  timeZone: 'IST'
}
document.write(n.toLocaleString("en-EN", options));


推荐阅读