gpt4 book ai didi

javascript - Angular : Convert Object into Date and Moment

转载 作者:行者123 更新时间:2023-11-29 17:34:07 24 4
gpt4 key购买 nike

我在 Kendo Datepicker 中收到日期的表单值。它作为对象出现。

picture

1)如何将以下内容转换为日期?

Debugger 中的以下内容仍将其保留为 Object

new Date(this.editHeaderAddressForm.value.seasonalEnd);

2) 此外,如何将其转换为 Moment?

最佳答案

Date.parse() 方法解析日期的字符串表示,并返回毫秒数

var javaScriptRelease = Date.parse('04 Dec 1995 00:12:00 GMT');

var newDate = Date('December 17, 1995 03:24:00');

console.log(javaScriptRelease);


> // expected output: 818035920000

console.log(newDate);

> // expected output: Sun Dec 17 1995 03:24:00 GMT...

关于javascript - Angular : Convert Object into Date and Moment,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58872366/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com