help-octave
[Top][All Lists]
Advanced

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

Conversion *from* ASCII date?


From: John W. Eaton
Subject: Conversion *from* ASCII date?
Date: Thu, 13 Mar 2003 19:16:41 -0600

On 13-Mar-2003, Eric M. Monsler <address@hidden> wrote:

| Hi,
| 
| I am trying to use Octave to parse and plot the text output of some 
| other data collections.
| 
| The file format is very simple, each line has a datestamp and then 
| tab-separated fields.
| 
| The problem is that I can't find in the documentation how to parse the 
| datestamp.  The format of the datestamp is as follows:
| 
| 03/12/2003 22:12:28.209
| 
| Is there any standard Octave way to parse this?

octave:1> help strptime 
strptime is the dynamically-linked function from the file
/usr/lib/octave/2.1.46/oct/i386-pc-linux-gnu/strptime.oct

 - Loadable Function: [TM_STRUCT, NCHARS] = strptime (STR, FMT)
     Convert the string STR to a time structure under the control of
     the format FMT.

Works similar to the C function of the same name.  The format is
similar to that used by strftime.

  octave:7> t = strptime ("03/12/2003 22:12:28.209", "%m/%d/%Y %X")
  t =
  {
    hour = 22
    isdst = 0
    mday = 12
    min = 12
    mon = 2
    sec = 28
    usec = 0
    wday = 3
    yday = 70
    year = 103
    zone = 
  }

  octave:8> strftime ("%D %X", t)
  ans = 03/12/03 22:12:28

jwe



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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