简体   繁体   English

如何将“Tue Nov 26 2019 16:00:00 GMT-0800”转换为 .net json 日期格式“\/Date(1574812800000)\/”格式?

[英]how can I Convert “Tue Nov 26 2019 16:00:00 GMT-0800” to .net json date formate “\/Date(1574812800000)\/” formate?

I need to conver my ison date formate to .net json date formate in javascript我需要将我的 iso 日期格式转换为 javascript 中的 .net json

like this Tue Nov 26 2019 16:00:00 GMT-0800" to "/Date(1574812800000)/"像这样 2019 年 11 月 26 日星期二 16:00:00 GMT-0800" 到 "/Date(1574812800000)/"

With JavaScript:使用 JavaScript:

 var dt = new Date("Tue Nov 26 2019 16:00:00 GMT-0800"); var format = "/Date("+dt.valueOf()+")/"; console.log(format);

You can use Moment.js:您可以使用 Moment.js:

moment("Tue Nov 26 2019 16:00:00 GMT-0800", "ddd MMM D YYYY H:m:s [GMT]ZZ").format("[/Date(]x[)/]")

You should get the result:你应该得到结果:

/Date(1574812800000)/

The timestamp you supplied corresponds to May 23, 2001 at midnight GMT.您提供的时间戳对应于 2001 年 5 月 23 日格林威治标准时间午夜。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 React 中将日期格式从 2020 年 7 月 2 日 00:00:00 GMT+0800 转换为 mm/dd/yyyy? - How to convert date's format from Jul 02 2020 00:00:00 GMT+0800 to mm/dd/yyyy in React? 日期格式的名称是什么,如何仅在 html 中显示日期? 2020 年 8 月 24 日星期一 00:00:00 GMT+0800(新加坡标准时间) - What is the name of the date format and how do I display just the date in html ? Mon Aug 24 2020 00:00:00 GMT+0800 (Singapore Standard Time) 将这种日期格式[2014年3月4日星期二00:00:00 GMT + 0530(斯里兰卡标准时间)]转换为Java Date对象 - Convert this kind of date format [Tue Mar 04 2014 00:00:00 GMT+0530 (Sri Lanka Standard Time) ] to Java Date Object 如何使用 JavaScript 将我的日期“2020 年 1 月 1 日星期三 00:00:00 GMT+0530(印度标准时间)”转换为 2020 年 1 月 1 日? - How can I convert my date “Wed Jan 01 2020 00:00:00 GMT+0530 (India Standard Time) ” to JAN 01,2020 using JavaScript? 如何将日期格式转换为其他格式 - How to convert date format into different formate 如何在打字稿中将字符串转换为日期格式 - How to convert string into date formate in typescript 如何在javascript中将日期一个格式转换为另一个格式? - how to convert date one formate to another in javascript? 如何验证其中包含时区的日期字符串的格式? - How can I validate the formate of a date string that has timezone in it? JavaScript:如何将日期字符串“ 2015年4月23日星期四00:00:00 GMT + 0200(CEST)”转换为时间戳? - JavaScript : how to Convert date string “Thu Apr 23 2015 00:00:00 GMT+0200 (CEST)” to timestamp? 如何将存储在变量中的日期转换为 jquery 中的日期格式? - how to convert the date stored in a variable in to a date formate in jquery?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM