Choose where you’d like to start

toLong

Overview

The toLong function takes an expression as an argument, and returns a number.

Return Type

  • NUMBER

Syntax

<variable> = <expression>.toLong();

(OR)

<variable> = toLong(<expression>);

(OR)

<variable> = <expression>.toNumber();

(OR)

<variable> = toNumber(<expression>);

where,

ParameterData typeDescription
<variable>NUMBERVariable which will contain the converted number.
<expression>NUMBER/DECIMAL/DATE-TIME/TEXT

The expression which will resolve to a number.

Note:

  • Date-time values will be converted into their equivalent number of milliseconds starting from '31-Dec-1969 16:00:00' (which is equivalent to 0).
    For instance, '31-Dec-1969 16:00:01'.toLong() will yield 1000 and '31-Dec-1969 15:59:59'.toLong() will yield -1000 and so on.
  • Decimals will be truncated off their fraction parts.
  • Empty texts will throw an error during runtime.

Examples

 marks = 99.9;
 marks_text = "100";

 info toLong(marks); // Returns 99
 info marks_text.toLong(); // Returns 100

Get Started Now

Execute