$ localStorage.doctorDateTime.push({ fullDate: new 日期(doctorDateTime)});
我在新日期中传递了日期字符串然后将其保存到本地存储但是当我从本地存储它显示我这种格式: 2015-01-01T13:41:18.300Z 如果是console.log(doctorDateTime) 。它显示正确的日期字符串
解决方案localStorage.doctorDateTime.push({ fullDate: new 日期(doctorDateTime)});
我在新日期传递了日期字符串然后将它保存到本地存储,但是当我从本地存储中检索它时,它显示我这种格式: 2015-01-01T13:41:18.300Z $如果是console.log(doctorDateTime),则b $ b。它显示正确的日期字符串
此格式是有效的UTC格式。 您可以将其转换为任何格式并相应地使用。 Date.Parse 可用于此任务 - developer.mozilla/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse [ ^ ] $localStorage.doctorDateTime.push({ fullDate : new Date(doctorDateTime) });
I passed date string in new Date and then save it to local storage but when i retrieve it from local storage it showing me this format: 2015-01-01T13:41:18.300Z while if console.log(doctorDateTime). it is showing right date string
解决方案 localStorage.doctorDateTime.push({ fullDate : new Date(doctorDateTime) });I passed date string in new Date and then save it to local storage but when i retrieve it from local storage it showing me this format: 2015-01-01T13:41:18.300Z while if console.log(doctorDateTime). it is showing right date string
This format is a valid UTC format. You can convert it into any format and use accordingly. Date.Parse can be used for this task - developer.mozilla/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse[^].更多推荐
本地存储返回无效的日期格式
发布评论