The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Time difference of more than 24 hours.

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

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]);
}

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000