Bitrix API

TypeConverter

FinalYes

Table of Contents

Methods

convertToDate()  : Date|bool
Converts value to Date
convertToDateTime()  : DateTime|bool
Converts value to Date with time
convertToDouble()  : float
Converts value to double
convertToInt()  : int|null
Converts value to int
convertToMoney()  : float
Converts value to money (double)
convertToString()  : string
Converts value to string

Methods

convertToDate()

Converts value to Date

public static convertToDate(string $value, string $format) : Date|bool
Parameters
$value : string
$format : string
Tags
example

'08/18/1960 (m/d/Y)

Return values
Date|bool

convertToDateTime()

Converts value to Date with time

public static convertToDateTime(string $value, string $format) : DateTime|bool
Parameters
$value : string
$format : string
Tags
example

'08/18/1960 15:45:20 (m/d/Y H:i:s)

Return values
DateTime|bool

convertToDouble()

Converts value to double

public static convertToDouble(mixed $value[, int|null $precision = null ][, string $delimiter = '.' ]) : float
Parameters
$value : mixed
$precision : int|null = null
$delimiter : string = '.'
Tags
example

'123 785,4463' => 123785.44, 123785.4463 => 123785.4

Return values
float

convertToInt()

Converts value to int

public static convertToInt(mixed $value) : int|null
Parameters
$value : mixed
Return values
int|null

convertToMoney()

Converts value to money (double)

public static convertToMoney(mixed $value[, int|null $precision = null ][, string $delimiter = '.' ]) : float
Parameters
$value : mixed
$precision : int|null = null
$delimiter : string = '.'
Tags
example

$8 816.77 => 8816.77

Return values
float

convertToString()

Converts value to string

public static convertToString(mixed $value) : string
Parameters
$value : mixed
Return values
string

        
On this page

Search results