# Converters

## CanBeDateTime

Checks whether the given Value can be converted to a DateTime.

#### Syntax <a href="#pragma-line-4477" id="pragma-line-4477"></a>

```
CanBeDateTime ( Value [, Format] [, Language] )
```

#### Parameters <a href="#pragma-line-4483" id="pragma-line-4483"></a>

***Value***\
&#x20;The Value to check.\
&#x20;Type: String

***Format*** (optional)\
&#x20;The Format of the Value.\
&#x20;Type: String

***Language*** (optional)\
&#x20;The Culture of the Value.\
&#x20;Type: Language

#### Return Type <a href="#pragma-line-4498" id="pragma-line-4498"></a>

Boolean

## CanBeInt

Checks whether the given Value can be converted to an Int.

#### Syntax <a href="#pragma-line-4507" id="pragma-line-4507"></a>

```
CanBeInt ( Value [, Language] )
```

#### Parameters <a href="#pragma-line-4513" id="pragma-line-4513"></a>

***Value***\
&#x20;The Value to check.\
&#x20;Type: String

***Language*** (optional)\
&#x20;The Culture of the Value.\
&#x20;Type: Language

#### Return Type <a href="#pragma-line-4524" id="pragma-line-4524"></a>

Boolean

## FromBase64String

Converts the given Base64 value to a string.&#x20;

As an example the Base64 value *VGhpcyBpcyBhIHRlc3Q* (UTF-8 default encoding) would be converted into String text *This is a test .* See [*ToBase64String* ](#tobase64string)for vice versa conversion.

#### Syntax

```
FromBase64String ( Value [, EncodingCodePage] ) 
```

#### Parameters

**Value**\
&#x20;The Value to convert.\
&#x20;Type: String

***EncodingCodePage*** (optional)\
&#x20;The encoding used for the conversion. Uses UTF-8 encoding by default.\
&#x20;Type: Integer

#### Return Type <a href="#pragma-line-4554" id="pragma-line-4554"></a>

String

## ToBase64String

Converts the given value to a Base64 string.&#x20;

As an example the String text *This is a test* would be converted using UTF-8 encoding by default into *VGhpcyBpcyBhIHRlc3Q= .* See [*FromBase64String* ](#frombase64string)for vice versa conversion.

#### Syntax

```
ToBase64String ( Value [, EncodingCodePage] ) 
```

#### Parameters

**Value**\
&#x20;The Value to convert.\
&#x20;Type: String

***EncodingCodePage*** (optional)\
&#x20;The encoding used for the conversion. Uses UTF-8 encoding by default.\
&#x20;Type: Integer

#### Return Type <a href="#pragma-line-4554" id="pragma-line-4554"></a>

Integer

## ToDateTime

Convert a String to a DateTime.

#### Syntax <a href="#pragma-line-4533" id="pragma-line-4533"></a>

```
ToDateTime ( Value [, Format] [, Language] )
```

#### Parameters <a href="#pragma-line-4539" id="pragma-line-4539"></a>

**Value**\
&#x20;The Value to convert.\
&#x20;Type: String

***Format*** (optional)\
&#x20;The Format of the Value to convert.\
&#x20;Type: String

***Language*** (optional)\
&#x20;The Culture of the Value.\
&#x20;Type: Language

#### Return Type <a href="#pragma-line-4554" id="pragma-line-4554"></a>

DateTime

## ToDouble

Convert a Value to a Double.

#### Syntax <a href="#pragma-line-4563" id="pragma-line-4563"></a>

```
ToDouble ( Value [, Language] )
```

#### Parameters <a href="#pragma-line-4569" id="pragma-line-4569"></a>

***Value***\
&#x20;The Value to convert.\
&#x20;Type: Any

***Language*** (optional)\
&#x20;The Culture of the Value.\
&#x20;Type: Any

#### Return Type <a href="#pragma-line-4580" id="pragma-line-4580"></a>

Double

## ToFloat

Convert a Value to a Float.

#### Syntax <a href="#pragma-line-4589" id="pragma-line-4589"></a>

```
ToFloat ( Value [, Language] )
```

#### Parameters <a href="#pragma-line-4595" id="pragma-line-4595"></a>

***Value***\
&#x20;The Value to convert.\
&#x20;Type: Any

***Language*** (optional)\
&#x20;The Culture of the Value.\
&#x20;Type: Language

#### Return Type <a href="#pragma-line-4606" id="pragma-line-4606"></a>

Float

## ToGuid

Converts a value to a Guid. The Guid has to be of valid format.

#### Syntax <a href="#pragma-line-4615" id="pragma-line-4615"></a>

```
ToGuid ( Value [, Format] )
```

#### Parameters <a href="#pragma-line-4621" id="pragma-line-4621"></a>

***Value***\
&#x20;The Value to convert.\
&#x20;Type: String

***Format*** (optional)\
&#x20;The Format of the Value to convert.\
&#x20;Type: String

#### Return Type <a href="#pragma-line-4632" id="pragma-line-4632"></a>

Guid

## ToInt

Convert a Value to an Int.

#### Syntax <a href="#pragma-line-4641" id="pragma-line-4641"></a>

```
ToInt ( Value [, Language] )
```

#### Parameters <a href="#pragma-line-4647" id="pragma-line-4647"></a>

***Value***\
&#x20;The Value to convert.\
&#x20;Type: Any

***Language*** (optional)\
&#x20;The Culture of the Value.\
&#x20;Type: Language

#### Return Type <a href="#pragma-line-4658" id="pragma-line-4658"></a>

Int

## ToString

Converts a value to a string. Can be formatted using the Format element. The language element determines the language if more than language are available.

#### Syntax <a href="#pragma-line-4667" id="pragma-line-4667"></a>

```
ToString ( Value [, Format] [, Language] )
```

#### Parameters <a href="#pragma-line-4673" id="pragma-line-4673"></a>

***Value***\
&#x20;String used as basis for the operation.\
&#x20;Type: Any

***Format*** (optional)\
&#x20;Format element which determines the format of the String.\
&#x20;Type: String

***Language*** (optional)\
&#x20;Determines the language of the String.\
&#x20;Type: Language

#### Return Type <a href="#pragma-line-4688" id="pragma-line-4688"></a>

String

## ToTimeSpan

Convert a String to a TimeSpan

#### Syntax <a href="#pragma-line-4697" id="pragma-line-4697"></a>

```
ToTimeSpan ( Value [, Format] [, Language] )
```

#### Parameters <a href="#pragma-line-4703" id="pragma-line-4703"></a>

***Value***\
&#x20;The Value to convert.\
&#x20;Type: String

***Format*** (optional)\
&#x20;The Format of the Value to convert.\
&#x20;Type: String

***Language*** (optional)\
&#x20;The Culture of the Value.\
&#x20;Type: Language

#### Return Type <a href="#pragma-line-4718" id="pragma-line-4718"></a>

TimeSpan

## CanBeDecimal

Checks whether the given Value can be converted to a Decimal.

#### Syntax <a href="#pragma-line-4563" id="pragma-line-4563"></a>

```
CanBeDecimal ( Value [, Language] )
```

#### Parameters <a href="#pragma-line-4569" id="pragma-line-4569"></a>

***Value***\
&#x20;Value as String: The Value to check.

***Language*** (optional)\
&#x20;The Culture of the Value.<br>

#### Return Type <a href="#pragma-line-4580" id="pragma-line-4580"></a>

Boolean

## ToDecimal

Converts a Value to a Decimal.

#### Syntax <a href="#pragma-line-4563" id="pragma-line-4563"></a>

```
ToDecimal ( Value [, Language] )
```

#### Parameters <a href="#pragma-line-4569" id="pragma-line-4569"></a>

***Value***\
&#x20;Value as Any: The Value to convert.

***Language*** (optional)\
&#x20;The Culture of the Value.<br>

#### Return Type <a href="#pragma-line-4580" id="pragma-line-4580"></a>

Decimal


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tivity.one/building-an-application/execution/scripting/functions/converters.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
