query.RelativeDate

Note:

The content in this help topic pertains to SuiteScript 2.0.

Object Description

A relative date to use in query conditions.

Use query.createRelativeDate(options) to create this object. After you create this object, you can use it in the values parameter of Query.createCondition(options) or Component.createCondition(options).

This object represents a specific moment in time, and you can use it to create query conditions using operators from the query.Operator enum, such as query.Operator.AFTER, query.Operator.BEFORE, and query.Operator.WITHIN. For more information about relative dates, see Relative Dates in the N/query Module.

Supported Script Types

Client and server scripts

For more information, see SuiteScript 2.x Script Types.

Module

N/query Module

Methods and Properties

RelativeDate Object Members

Since

2019.1

Syntax

Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/query Module Script Samples.

            // Add additional code
...
var myEndDate = query.createRelativeDate({ dateId: query.DateId.WEEKS_AGO, value: 2
}); var myComplexCondition = myQuery.createCondition({ fieldId: 'trandate', operator: query.Operator.WITHIN, values: [query.RelativeDateRange.THREE_FISCAL_YEARS_AGO.start, myEndDate]
});
...
// Add additional code 

          

Related Topics

N/query Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices