Hey guys,
I'm trying to determine a time interval (in years) between 2 date vectors. I'm working with coupon bonds so I need to know how much time between today's date and the expiry of the bond.
Assume today is March 31, 1997: the date number is = 729480
Let's the say the bond expires on: October 15, 2026, date number = 740270.
Is there a way to manipulate these two date numbers so I can get the difference between them in years? (around 29.xx years)
Thanks,
Anthony
|
|
0
|
|
|
|
Reply
|
Anthony
|
10/9/2010 5:02:03 PM |
|
"Anthony " <antfarinaccio@gmail.comremove.spam> wrote in message <i8q76b$fh7$1@fred.mathworks.com>...
> Hey guys,
>
> I'm trying to determine a time interval (in years) between 2 date vectors. I'm working with coupon bonds so I need to know how much time between today's date and the expiry of the bond.
>
> Assume today is March 31, 1997: the date number is = 729480
> Let's the say the bond expires on: October 15, 2026, date number = 740270.
>
> Is there a way to manipulate these two date numbers so I can get the difference between them in years? (around 29.xx years)
>
> Thanks,
> Anthony
For an approximate answer:
(datenum2 - datenum1)/365.25
James Tursa
|
|
0
|
|
|
|
Reply
|
James
|
10/9/2010 7:40:05 PM
|
|
Thanks James!
That works for me!
Anthony
|
|
0
|
|
|
|
Reply
|
Anthony
|
10/9/2010 7:52:03 PM
|
|