Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Netsuite SuiteScript 2.0将时区应用于字段_Netsuite_Suitescript2.0 - Fatal编程技术网

Netsuite SuiteScript 2.0将时区应用于字段

Netsuite SuiteScript 2.0将时区应用于字段,netsuite,suitescript2.0,Netsuite,Suitescript2.0,我需要从“记录”中“获取”一个日期字段并应用一个时区,在1.0中,它只是使用getDateTimeValue并将时区作为第二个参数传递。在2.0中,您只有通用的getValue,当将TZ作为第二个值传递或在options包中传递它时,它似乎只是忽略了它。有人有主意吗?我在文件里找不到 提前感谢在SuiteScript 2.0中,您需要使用将时区应用于原始日期 用法示例如下所示: require(['N/format'], function () { var format = requi

我需要从“记录”中“获取”一个日期字段并应用一个时区,在1.0中,它只是使用getDateTimeValue并将时区作为第二个参数传递。在2.0中,您只有通用的getValue,当将TZ作为第二个值传递或在options包中传递它时,它似乎只是忽略了它。有人有主意吗?我在文件里找不到


提前感谢

在SuiteScript 2.0中,您需要使用将时区应用于原始日期

用法示例如下所示:

require(['N/format'], function () {

    var format = require('N/format');
    var now = new Date();
    console.log(now);
    var nyTime = format.format({
        value:now,
        type:format.Type.DATETIME,
        timezone:format.Timezone.AMERICA_NEWYORK
    });
    console.log('NY time is ' + nyTime);
    var gmt = format.format({
        value:now,
        type:format.Type.DATETIME,
        timezone:format.Timezone.GMT
    });

console.log('London time is ' + gmt);
});

您可以将上述内容粘贴到新事务页面的控制台中,然后运行该页面以演示如何使用它。

在SuiteScript 2.0中,您需要使用将时区应用于原始日期

用法示例如下所示:

require(['N/format'], function () {

    var format = require('N/format');
    var now = new Date();
    console.log(now);
    var nyTime = format.format({
        value:now,
        type:format.Type.DATETIME,
        timezone:format.Timezone.AMERICA_NEWYORK
    });
    console.log('NY time is ' + nyTime);
    var gmt = format.format({
        value:now,
        type:format.Type.DATETIME,
        timezone:format.Timezone.GMT
    });

console.log('London time is ' + gmt);
});
您可以将上述内容粘贴到新事务页面的控制台中,并运行它来演示如何使用它