Modules

filter

 

Objects/Functions

module (N/format)

SuiteScript 2.0

format.format(options)

{format}.format({value: {Date | string | number*},type: {string*}})

N/format Module
format.format()
Method Description: Formats a value from the raw value to its appropriate preference format. This method is overloaded when you format a datetime or datetimetz value.
Returns: If a datetime or datetimetz value is specified, the string in date format is returned in the user’s local app time zone. If an invalid value is given, the original value passed to options.value is returned. For client side scripts, the string returned is based on the user’s system time. For server-side scripts, the string returned is based on the system time of the server your NetSuite system is running on.
Supported Script Types: Client and server-side scripts For more information, see SuiteScript 2.0 Script Types
Governance: None
Module: N/format Module
Since: 2015.2
Search NetSuite - https://system.netsuite.com/app/help/helpcenter.nl?search=format.format(options)

Example:

// Code Example 1
// Add additional code
//...
function(format){
function formatToString() {
// Assume number format is 1.000.000,00 and negative format is (100)
var rawNum2 = -44444.44
return format.format({value:rawNum2, type: format.Type.FLOAT})
}
var formattedNum2 = formatToString(); // "44.444,44" -- a string
//...
// Add additional code

//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4388843892.html