Banks use the formula - The interest rate is computed as:
Where "r" is the interest rate, "i" is the number of periods of interest and "t" is time period. So for example, if one period of interest equals to 1 day then one period of interest equals to 365 days. If there are 30 days then one year will be calculated as 30 x 365 x 24 x 7 = 12,370 days. If there are a number of periods equal to a year then it will be calculated as 2 years. It is important to note that the formula only works with borrowing rates and not lending rates, for this reason banks do not come up with this formula on their own but borrow from other sources such as treasury bills or repos etc.