Netsuite SuiteScript 2.0将时区应用于字段
我需要从“记录”中“获取”一个日期字段并应用一个时区,在1.0中,它只是使用getDateTimeValue并将时区作为第二个参数传递。在2.0中,您只有通用的getValue,当将TZ作为第二个值传递或在options包中传递它时,它似乎只是忽略了它。有人有主意吗?我在文件里找不到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
提前感谢在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);
});
您可以将上述内容粘贴到新事务页面的控制台中,并运行它来演示如何使用它