gpt4 book ai didi

javascript - JSON 到 javascript Date.UTC

转载 作者:太空宇宙 更新时间:2023-11-04 06:42:42 25 4
gpt4 key购买 nike

我有以下 JSON:

[
[
"26-Sep-14",
10
],
[
"29-Sep-14",
75
]
]

JSON 中的数据用于创建 highcharts 图表,该图表需要 Date.UTC() 格式的日期。目前 highcharts 将日期视为字符串。有没有办法通过 json 正确格式化每个日期 (Date.UTC)?

json 最初来自 Pandas 数据框,所以在创建 JSON 之前在 python 中进行更改也许会更好?但是我没有任何运气让它在 javascript 或 python 中工作。

非常感谢您的任何建议。

最佳答案

遍历您的 python Pandas 数据对象,对于每个日期,使用 python datetime 模块将其转换为必要的格式,使用 strftime()

关于javascript - JSON 到 javascript Date.UTC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26761291/

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