datenum returns invalid result for month?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

datenum returns invalid result for month?

Fritz Sonnichsen
I am working with datenum. If you run the statements below you will get:
10.380 and 100.38 for the results.
Should they not be the same?

Thanks
Fritz
=================================================
    dfm   =  'MM/DD/YYYY,HH:MM:SS';
    datenum ('04/10/2018,09:07:41',dfm) - datenum (2018, 0, 0, 0, 0, 0)
    datenum (2018, 04, 10, 09, 07, 41)       - datenum (2018, 0, 0, 0,
0, 0)



Reply | Threaded
Open this post in threaded view
|

Re: datenum returns invalid result for month?

Mike Miller-4
On Tue, Apr 10, 2018 at 12:33:49 -0400, Fritz Sonnichsen wrote:
> I am working with datenum. If you run the statements below you will get:
> 10.380 and 100.38 for the results.
> Should they not be the same?

Note the critical difference between "MM" and "mm" in the date format
string. You should also be using "dd" and "yyyy", but since there is no
conflict Octave allows either upper or lower case.

--
mike



signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: datenum returns invalid result for month?

Fritz Sonnichsen
OK-that worked!

thanks
Fritz