T O P I C R E V I E W |
cyberjuda |
Posted - 01/20/2015 : 06:31:03 AM Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 9.1.0 (64-bit) Operating System: Windows 7
Hi,
I am trying to subtract dates with time and put them in another column as minutes (numeric). I am using the following command and it works fine until the difference is more than 24 hours. I realize this is because of the hour command only reading up till 24. Can someone suggest a workaround?
col(1)=minute(col(4)-col(4)[1])+60*hour(col(4)-col(4)[1]);
|
3 L A T E S T R E P L I E S (Newest First) |
lkb0221 |
Posted - 01/21/2015 : 09:35:09 AM col(1) = (col(4)-col(4)[1]) / time(00:01:00); |
cyberjuda |
Posted - 01/21/2015 : 05:51:47 AM Thanks, it works great. Is there some way to do it without a loop? This is part of a big script and I want to reduce the time.
|
lkb0221 |
Posted - 01/20/2015 : 09:52:45 AM wcol(1)[1] = 0; for (int row = 2; row <= wks.nrows; row++) { wcol(1)[row] = wcol(1)[row-1] + minute(wcol(4)[row]-wcol(4)[row-1])+60*hour(wcol(4)[row]-wcol(4)[row-1]); } |