【发布时间】:2021-06-22 22:09:28
【问题描述】:
这是我使用 API 从 sharepoint 调用的数据
然后我尝试将对象转换为日期时间格式。但它返回 NaN 值
这是我尝试过的代码
.subscribe((dataChart) => {
console.log(dataChart)
console.log(typeof(dataChart))
var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
var str=dataChart.strRequestDate; //Set the string in the proper format(best to use ISO format ie YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS)
var d=new Date(str); //converts the string into date object
var m=d.getMonth(); //get the value of month
console.log(m) // Print the month name
},
谁能指出我的错误
编辑: 根据@N.F 说明,在我控制台登录 e 后出现项目列表
【问题讨论】:
标签: angular typescript datetime object type-conversion