Andrew, it's not clear to me why you are converting datetimes to datevecs and then using etime. Not sure I've followed what you want to do, but this seems much simpler:
>> epoch = datetime('2000-01-01 12:00:00')
epoch =
datetime
01-Jan-2000 12:00:00
>> launch = datetime('2040-04-17 12:00:00')
launch =
datetime
17-Apr-2040 12:00:00
>> Tlaunch = launch - epoch % as hh:mm:ss
Tlaunch =
duration
353208:00:00
>> Tlaunch.Format = 'd' % as 24hr days
Tlaunch =
duration
14717 days
Here's how you add the seconds
>> afterTrans12 = seconds(123456)
afterTrans12 =
duration
123456 sec
>> launch = launch + afterTrans12
launch =
datetime
18-Apr-2040 22:17:36
>> JDLaunch = juliandate(launch)
JDLaunch =
2466263.42888889
>> %position.earth.launch = planetEphemeris(JDLaunch,'Sun','Earth');
