Using Datetime Fields
You can work with date and datetime fields using the date and datetime types in NetSuite. See the following sections for information about working with date and datetime types.
When setting a date field using REST web services, you must enter a date or datetime value. You can also specify a time zone in your request. Datetime values are returned in UTC format.
Types of Date-related Fields
The following four types of date-related fields are used in NetSuite.
Type |
Example |
Notes |
---|---|---|
Date fields |
10/05/2018 |
Date fields are used, for example, on custom records. |
Time fields |
10:15 am |
Time fields are used, for example, on custom records. |
Datetime fields |
10/05/2018 10:15 am |
Datetime fields are used, for example, on custom records. |
Duration fields |
25:45 (hours:minutes) |
Duration fields are used in time tracking, for example, on time bill records. |
Date Field
Date fields use the date element of datetime fields. For example: 2017-07-21. Date field values are not subject to any time zone conversion.
Time Fields
Time fields use the time element of datetime fields, with hours, minutes and second. For example: 17:32:28. Time field values are not subject to any time zone conversion.
Datetime Fields
REST web services use datetime fields in ISO 8601 format and in the UTC time zone. For example: 2017-07-21T17:32:28Z.
Date is the full-date notation as defined by RFC 3339, section 5.6, for example, 2017-07-21.
Date-time is the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z.
All datetime values loaded from NetSuite are converted to the UTC time. REST web services accepts datetime values in the same format and in the UTC time zone.
In REST web services, you can also specify the time zone in your request. For example, 2017-07-21T17:32:28+01:00.
During record collection filtering, REST web services uses the underlying N/query SuiteScript module, which uses a different date format. For examples, see Record Collection Filtering.
Duration Fields
Duration fields use the same format as in UI, that is, "hh:mm". For example: "25:42". Duration field values are not subject to any time zone conversion.
Related Topics
- The REST API Browser
- NetSuite Record Structure
- Using CRUD Operations on Custom Records, Custom Lists, and Custom Transactions v1
- Creating a Record Instance
- Getting a Record Instance
- Updating a Record Instance
- Using the Upsert Operation
- Deleting a Record Instance
- Accessing Subresources in REST Web Services
- Using External IDs
- Executing Record Actions
- Transforming Records
- Working with the Pricing Sublist on Item Records
- Using the REST Web Services SuiteScript Execution Context