javascript - 我想使用 Javascript 将字符串日期“星期六,2021 年 7 月 3 日 06:06:06 GMT”转换为格式为“yyyy-MM-dd'T'HH:mm”的字符串
问题描述
任何人都可以帮助提供代码吗?
function getDateTimeinUTC(inputstringdate) {
//Code to convert "Sat, 03 Jul 2021 06:06:06 GMT to a date and then use below sort of code to convert it to yyyy-MM-dd'T'HH:mm
var DateTimeFormatter = Java.type('java.time.format.DateTimeFormatter');
var dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm");
var ldt = java.time.LocalDateTime.now(java.time.ZoneOffset.UTC);
return ldt.format(dtf);
}
解决方案
推荐阅读
- javascript - javascript:如何在 vue ref 中绑定 mouseover 事件
- javascript - Webpack CSS 和 JS 在开发模式下没有被缩小
- docker - 在 docker-compose.yml 中找不到“:”
- swift - 返回为字符串的素数分解
- django - 没有为 Locust 客户端创建 Django sessionid
- azure-devops - Azure Devops CLI 任务 - 显示输出
- javascript - 具有多个条件的 MongoDB findOneAndDelete()(在嵌套数组中)
- google-cloud-platform - 如何使用 Terraform 正确更改 Google Kubernetes Engine 节点池?
- android - Kotlin Firebase 读取子数据的子数据
- sql-server-agent - SQL Server 代理作业:通过电子邮件发送错误消息