【问题标题】:How to convert object to string using suitescript如何使用 suitescript 将对象转换为字符串
【发布时间】:2023-02-02 07:44:41
【问题描述】:

我正在尝试将对象转换为字符串。我使用了很多方法,但无法获取字符串格式的对象。我得到的是转换后的对象,{"Roll #":59,"Birth date":44841,"Marks":"70"} 我也得到了 excel 数据。在脚本日志中,日期 07-10-2022 自动转换为 44841。请帮忙!

这是我的代码: const excelData = JSON.stringify(数据); log.debug("excelData",excelData);

【问题讨论】:

  • 你如何获得日期值?它取自什么字段类型?它是如何被采取的?
  • 我正在使用 sheetJS 为 netsuite 库获取所有 excel 数据

标签: oracle netsuite suitescript suitescript2.0 netsuite2.com


【解决方案1】:

JSON.stringify 可以解决典型对象的问题,但您使用的库返回的是库中定义的类的实例,而 date 属性实际上不是 Date 对象,而是其他对象。

https://docs.sheetjs.com/docs/csf/features/dates/

【讨论】:

    猜你喜欢
    • 2021-02-03
    • 2018-07-19
    • 2019-07-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多