# Conversion Functions

Learn how to use conversion functions in expressions in ActiveReportsJS.

## Content



### ToBoolean 

Converts a specified value to an equivalent ```boolean``` value.

**Syntax**

ToBoolean(```value```)

**Arguments**

* ```value``` - a value to convert


**Examples**

You can use the following expression to convert "true" or "false" strings to a boolean value.

```js
{ToBoolean("true")}
```

### ToChar

Converts a specified value to a Unicode character.

**Syntax**

ToChar(```value```)

**Arguments**

* ```value``` - a value to convert


**Examples**

You can use the following expression to convert the ```copyright``` symbol code to a character.

```js
{ToChar(169)}
```


### ToDateTime

Converts a specified value to a [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) value.

**Syntax**

ToDateTime(```value```)

**Arguments**

* ```value``` - a value to convert


**Examples**

You can use the following expression to convert the ```2020-05-06``` string to the corresponding date.

```js
{ToDateTime("2020-05-06")}
```


### ToInt16, ToInt32, ToInt64, ToUInt16, ToUInt32, ToUInt64, ToDecimal, ToByte, ToDouble, ToSingle

Converts a specified value to a number. JavaScript numbers are always stored as double-precision floating-point numbers, following the international IEEE 754 standard.

**Syntax**

* ToInt16(```value```)
* ToInt32(```value```)
* ToInt64(```value```)
* ToUInt16(```value```)
* ToUInt32(```value```)
* ToUInt64(```value```)
* ToByte(```value```)
* ToDouble(```value```)
* ToSingle(```value```)

**Arguments**

* ```value``` - a value to convert


**Examples**

You can use the following expression to convert the ```123``` string to the number.

```js
{ToInt16("123")}
```


### ToString

Converts a specified value to a string.

**Syntax**

ToString(```value```)

**Arguments**

* ```value``` - a value to convert


**Examples**

You can use the following expression to convert the ```123.456``` number to the string.

```js
{ToString(123.456)}
```

### Format

Returns a string containing a value formatted according to instructions contained in a format string.

**Syntax**

Format(```value```, ```format```)

**Arguments**

* ```value``` - a value to format
* ```format``` - the format string. ActiveReportsJS follows the .NET conventions for format strings:
    * [Standard Numeric Format Strings](https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings)
    * [Custom Numeric Format Strings](https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings)
    * [Standard Date and Time Format Strings](https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings)
    * [Custom Date and Time Format Strings](https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings)

**Examples**

You can use the following expression to format the ```UnitPrice``` field value as currency with three decimal digits.

```js
{Format(UnitPrice, "c3")}
```