Here’s a good post on how bonds are calculated: Bond Mechanics 101
Here’s an excerpt:
Bonds generally use a “30/360” convention to determine how interest accrues over time. This means that interest will be computed on the basis of a 360-day year comprised of twelve 30-day months. Said a different way, 8.33333% of the annual interest payments on the bonds will accrue during each full month that the bonds remain outstanding (without regard to the actual number of days in the month). Note that this methodology differs from the “actual/365” convention used in the bank loan market.
When calculating the accrual period, it’s important to know that interest only accrues overnight. This means, in bondland, you don’t include the end date (i.e., the payment date) when calculating the period within a range of dates, since it is the start date of, and is included in, the next interest accrual period. For example, during the period “from July 1 to July 24,” a total of 23 nights of interest will accrue. July 1 counts and July 24 does not.
In bondland, for each calendar month (from the 1st of a month to the 1st of the next month), 30 nights of interest will be deemed to accrue, regardless of the actual number of nights in the month. Thirty is the magic number. Note that this produces some interesting results. For example, the amount of interest accruing during the first 30 nights of a 31-night month is the same as the amount of interest accruing for the entire month (so, no interest accrues on that 31st night). And the last night of February is a particularly good night for bondholders; during a leap year, two nights of interest accrue during the night of the 29th and, during a normal year, three nights of interest accrue during the night of the 28th.
- For bonds with interest payment dates on February 15 and August 15, as of noon on March 3, 2013, even though 16 nights have passed since the last interest payment date, 18/360ths (or 5%) of the annual coupon will have accrued. This is the math: 16 nights from February 15 to March 1 (14 actual nights, increased by two extra nights on the night of February 28th, to produce a 30-night calendar month), plus 2 nights for the nights of March 1 and 2 = 18.