I'd use the todayno verb from dates.ijs to convert the Y M D columns
NB. Start J code
NB. ------------------------
require 'dates'
NB. sample data
d=: 0". [;._2 (0 : 0)
2008 12 01 00 46 16
2008 12 01 01 46 19
2008 12 01 03 49 52
2008 12 01 04 49 56
2008 12 01 09 05 33
)
NB. convert to days and decimals of days
t=.(todayno 3{."1 d) + 86400%~0 60 60#._3{."1 d
NB. convert to interval in minutes
ti=: }:_1440*t-1|.t
ti
60.05 123.55 60.0667 255.617
NB. End J code
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of David Vincent-Jones
Sent: Saturday, January 03, 2009 13:55
To: JSoftware
Subject: [Jprogramming] Time Intervals
I have a series of time-stamps taken from a pump station where I need to
evaluate the operating intervals in minutes.
The stamps run over day ends, month and even years so I am looking for a
simple way to count time from a fixed date .. even a recent date such as
'2008 01 01 00 00.00' would be fine.
data example:
2008 12 01 00 46 16
2008 12 01 01 46 19
2008 12 01 03 49 52
2008 12 01 04 49 56
2008 12 01 09 05 33
I have been doing this the hard way with lots of 'intervention' but
probably somebody has already solved this elegantly and ideas would be
appreciated.
David
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm