Modules
Objects/Functions
SuiteScript 2.0
{format}.parse({value: {string*},type: {string*}})
N/format Module
format.parse()
Method Description:
Parses a value from the appropriate preference format to its raw value. The appropriate preference format is the one selected in the Date Format field at Home > Set Preferences.
For a datetime or datetimetz value, use this method to convert a Date Object into a string based on the specified timezone.
This method is overloaded when you format a datetime or datetimetz value.
Returns:
Datetime or datetimetz values are returned as a Date Object.
If the value given is not valid or parsable, the original value passed to options.value is returned.
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.parse(options)
Example:
// Code Example 1
// Add additional code
//...
function(format){
function parseToValue() {
// Assume number format is 1.000.000,00 and negative format is -100
var formattedNum = "-20.000,25"
return format.parse({value:formattedNum, type: format.Type.FLOAT})
}
var rawNum = parseToValue(); // -20000.25 -- a number
//...
// Add additional code
//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4388837989.html