Bitrix Site Manager

CCurrencyRates::GetConvertFactor

float
CCurrencyRates::GetConvertFactor(
 string curFrom, 
 string curTo, 
 string valDate = ""
);

The method GetConvertFactor returns the factor for converting amounts from currency curFrom to currency curTo at the exchange rate set on the date valDate.

Parameters

ParameterDescription
curFrom The currency to be converted.
curTo The currency to which the conversion is to be performed.
valDateThe date of the exchange rate at which the conversion is to be performed. If the date is empty, the conversion is performed at the current rate.

Return Values

Returns the conversion factor.

Example


<?
$arVals = array(11.95, 18.27, 5.01);
$rate_cost = CCurrencyRates::GetConvertFactor("GBP", "USD");
for ($i = 0; $i < count($arVals); $i++)
{
    echo $arVals[$i]." GBP = ".Round($rate_cost*$arVals[$i], 2)." USD";
}
?>