javascript - 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?
解决方案
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));
推荐阅读
- django-models - Django:如何从不同类别的产品中列出一个类别的产品
- visual-studio - Blazor:无法启动调试适配器
- javascript - Angular NullInjectorError 没有服务提供者?
- c# - 无法在我的 Lambda 函数中调用外部 rest api
- android - 在 Flutter 中使用 Google fit API
- ios - 如何修复 React Native 中的 yarn ios 构建错误?
- spring-boot - Spring Boot,springdoc-openapi 1.5.8 - Swagger Annotations,Swagger UI 示例值
- python-3.x - 将 avro 文件压缩为 gzip (.gz) 压缩
- django - 如何在 Django Admin 列表视图中启用水平滚动?
- sql - SQL Server 2017 将 Varchar 转换为日期