简体   繁体   English

如何从Netsuite SuiteScript 2.0中以毫秒为单位获取日期和时间字段的值

[英]How to get values of date & time fields as millisecs from netsuite suitescript 2.0

In Suitescript 2.0, I can able to get record by id. 在Suitescript 2.0中,我可以按ID获取记录。

RESTlet: 的Restlet:

    var response = record.load({
        type: resourceType,
        id: context.recordId
    });

Response: 响应:

{
   ...
   "starttime": "6:00 pm",
   "startdate": "13 FEBRUARY, 2019"
   ...
}

How to get all date & time values as millisecs in Netsuite using suitescript 2.0? 如何使用suitescript 2.0在Netsuite中获取所有以毫秒为单位的日期和时间值?

NetSuite has 2 types of date fields, date and dateTime . NetSuite具有2种日期字段,即datedateTime

Date field does not contain time details, so you cannot get time from these fields like trandate etc. Whereas if you use getValue on dateTime field, NetSuite returns a date object and you can toISOString or any other method from Date class. Date字段不包含时间详细信息,因此您无法从trandate等字段中获取时间。而如果您在dateTime字段上使用getValue ,则NetSuite会返回一个日期对象,并且您可以从Date类使用toISOString或任何其他方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM