Exchange Rates
When manipulating monetary amounts you often need to convert between currencies.
Money2 provide a simple method to convert a Money
instance to another currency using an exchange rate.
To converts a Money
instance into a target Currency
use the Money.exchangeTo
method and an ExchangeRate.
To do this you need to define an exchange rate which consists of a rate, a from currency and a to currency.
Example
Lets say you have an invoice in Australian Dollars (AUD) which you need to convert to US Dollars (USD).
Start by googling the exchange rate for AUD to USD. You are likely to find something similar to:
1 AUD = 0.68c USD
Which means that for each Australian Dollar you will receive 0.68 US cents. (AKA I'm not traveling to the USA this year).
To do the above conversion:
Last updated