Re: format datestr

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

Re: format datestr

Dmitri A. Sergatskov


On Sun, Jun 17, 2018 at 7:52 AM, Luca Salardi <[hidden email]> wrote:
hi,
i try to code it :

ff=datestr ("23/12/2008", "dd/mm/yyyy")

but i see this error:

error: datevec: none of the standard formats match the DATE string


​You want to use datenum():

octave:9> ff=datenum ("23/12/2008", "dd/mm/yyyy")
ff =  733765
octave:10> str=datestr (ff, "dd/mm/yyyy")
str = 23/12/2008

​Dmitri.
--





Reply | Threaded
Open this post in threaded view
|

Re: format datestr

Thomas D. Dean-2
On 06/17/18 05:52, Luca Salardi wrote:
> hi,
> i try to code it :
>
> ff=datestr ("23/12/2008", "dd/mm/yyyy")
>
> but i see this error:
>
> error: datevec: none of the standard formats match the DATE string
>
Help datestr is not clear on this.  Nor, is help datevec.

Your DATE is not in the correct format.

 From help datevec,

A date vector is a row vector with six members, representing the
      year, month, day, hour, minute, and seconds respectively.

Your DATE string contains day, month, and year respectively.

You should use year, month, and day in the DATE string.

octave:41> ff=datestr ("2008/12/23", "dd/mm/yyyy")
ff = 23/12/2008


Tom Dean