我有 Fullcalender 的事件,它们的返回日期为字符串格式,就像这样 'Wed Oct 23 2019 00:00:00 GMT+0530 (India Standard Time)'
我想将其转换为与 JavaScript 日期完全相同的格式 Wed Oct 23 2019 00:00:00 GMT+0530 (India Standard Time)
.因为我想用这个方法toDateString()
检查一些条件。
最佳答案
从字符串到日期类型:
const dateStr = 'Wed Oct 23 2019 00:00:00 GMT+0530 (India Standard Time)';
const dateObj = new Date(dateStr) // insert your date variable here
关于javascript - 将字符串日期转换为 JavaScript 日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58519965/