source: FOIAVistA/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSGCT.m@ 1528

Last change on this file since 1528 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 603 bytes
Line 
1PSGCT ;BIR/CML3-ADD OR SUBTRACT MINUTES FROM A DATE/TIME ;16 DEC 97 / 1:36 PM
2 ;;5.0; INPATIENT MEDICATIONS ;;16 DEC 97
3 ;
4EN(ST,AM) ;
5 ; ST=start date/time AM=minutes (+ or -) X=new date/time
6 N H,HRS,M,MN,T,X,X1,X2
7 S:'AM X=ST Q:'AM X S T=1 S:AM<0 T=-1,AM=-AM S X2=AM\1440,AM=AM-(X2*1440),H=AM\60,M=AM#60,HRS=+$E(ST_"0000",9,10),MN=+$E(ST_"0000",11,12),X=$P(ST,".")
8 I M S MN=MN+(M*T) S:MN>59 MN=MN-60,H=H+1 S:MN<0 MN=MN+60,H=H+1
9 S:H HRS=HRS+(H*T) S:HRS>24!(HRS=24&MN) HRS=HRS-24,X2=X2+1 S:HRS<0 HRS=HRS+24,X2=X2+1
10 I X2 S X1=X,X2=X2*T D C^%DTC
11 S X=+(X_"."_$E(0,HRS<10)_HRS_$E(0,MN<10)_MN) Q X
Note: See TracBrowser for help on using the repository browser.