help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Struggling to write t0 from sometime ago


From: Nicholas Jankowski
Subject: Re: Struggling to write t0 from sometime ago
Date: Fri, 18 Aug 2017 14:32:40 -0400



On Fri, Aug 18, 2017 at 1:42 PM, Mphumzi Tshentu <address@hidden> wrote:
Would please help me, I tried to write t0 from 09h27min35sec in 17 February 2002. I want to get the time elapsed from that date up to a certain date later , for an example 13h22min40sec in 18 June 2004.


ok, that's much more clear. you should understand that you need to follow basic programming syntax, so parentheses must be closed ( ( ) ).  that's why you got the syntax error.

for your actual usage,  learn about date counting in the Octave help
https://www.gnu.org/software/octave/doc/v4.0.0/Timing-Utilities.html#Timing-Utilities

something like the following should work for you:

>> t0 = datenum(2002, 2, 17, 09, 27, 35)
t0 =   7.3126e+005

>> t1 = datenum(2004, 6, 18, 13, 22, 40)
t1 =   7.3212e+005

>> days_elapsed = t1-t0
days_elapsed =  852.16

>> approximate_years_elapsed = dayselapsed / 365.25
approximate_years_elapsed =  2.3331

reply via email to

[Prev in Thread] Current Thread [Next in Thread]