XQDATE ;SEA/MJM - Return Human Readible Date ;04/13/98 13:48
;;8.0;KERNEL;**71,46**;Jul 10, 1995
;Input: XQD1 contains $H to be converted, defaults to now if not
;present. Output: % contains date in FileMan format, %Y contains
;date and time in Human format (Feb. 20, 1991 5:35 PM)
;
;Modified 1/27/98 to reflect Y2K corrections.
;
S U="^" I '$D(XQD1) S XQD1=$H
S %=$$HTFM^XLFDT(XQD1)
S %Y=$$FMTE^XLFDT(%,"1P")
K XQD1
Q
;
S %=XQD1>21608+XQD1-.1,XQD2=%\365.25+141,%=%#365.25\1,XQD3=%+306#(XQD2#4=0+365)#153#61#31+1,XQD4=%-XQD3\29+1,XQD5=XQD2_"00"+XQD4_"00"+XQD3
S %=$P(XQD1,",",2),%=%#60/100+(%#3600\60)/100+(%\3600)/100,%=XQD5_$S(%:%,1:"")
S XQD1="Jan^Feb^Mar^Apr^May^Jun^Jul^Aug^Sep^Oct^Nov^Dec"
S %Y=$P(XQD1,U,XQD4),%Y=%Y_$S(%Y["May":"",1:".")_" "_XQD3_", "_(XQD2+1700)
S XQD2=$E($P(%,".",2),1,4) I $L(XQD2)<4 F XQD5=0:0 S XQD2=XQD2_"0" Q:$L(XQD2)=4
S XQD4=$S(XQD2>1159:"PM",1:"AM"),XQD3=$E(XQD2,1,2),XQD3=$S(XQD3>12:XQD3-12,1:XQD3),XQD2=$E(XQD2,3,4)
S %Y=%Y_" "_+XQD3_":"_XQD2_" "_XQD4
K XQD1,XQD2,XQD3,XQD4,XQD5
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXQDATE 1067 printed Dec 13, 2024@02:05:38 Page 2
XQDATE ;SEA/MJM - Return Human Readible Date ;04/13/98 13:48
+1 ;;8.0;KERNEL;**71,46**;Jul 10, 1995
+2 ;Input: XQD1 contains $H to be converted, defaults to now if not
+3 ;present. Output: % contains date in FileMan format, %Y contains
+4 ;date and time in Human format (Feb. 20, 1991 5:35 PM)
+5 ;
+6 ;Modified 1/27/98 to reflect Y2K corrections.
+7 ;
+8 SET U="^"
IF '$DATA(XQD1)
SET XQD1=$HOROLOG
+9 SET %=$$HTFM^XLFDT(XQD1)
+10 SET %Y=$$FMTE^XLFDT(%,"1P")
+11 KILL XQD1
+12 QUIT
+13 ;
+14 SET %=XQD1>21608+XQD1-.1
SET XQD2=%\365.25+141
SET %=%#365.25\1
SET XQD3=%+306#(XQD2#4=0+365)#153#61#31+1
SET XQD4=%-XQD3\29+1
SET XQD5=XQD2_"00"+XQD4_"00"+XQD3
+15 SET %=$PIECE(XQD1,",",2)
SET %=%#60/100+(%#3600\60)/100+(%\3600)/100
SET %=XQD5_$SELECT(%:%,1:"")
+16 SET XQD1="Jan^Feb^Mar^Apr^May^Jun^Jul^Aug^Sep^Oct^Nov^Dec"
+17 SET %Y=$PIECE(XQD1,U,XQD4)
SET %Y=%Y_$SELECT(%Y["May":"",1:".")_" "_XQD3_", "_(XQD2+1700)
+18 SET XQD2=$EXTRACT($PIECE(%,".",2),1,4)
IF $LENGTH(XQD2)<4
FOR XQD5=0:0
SET XQD2=XQD2_"0"
if $LENGTH(XQD2)=4
QUIT
+19 SET XQD4=$SELECT(XQD2>1159:"PM",1:"AM")
SET XQD3=$EXTRACT(XQD2,1,2)
SET XQD3=$SELECT(XQD3>12:XQD3-12,1:XQD3)
SET XQD2=$EXTRACT(XQD2,3,4)
+20 SET %Y=%Y_" "_+XQD3_":"_XQD2_" "_XQD4
+21 KILL XQD1,XQD2,XQD3,XQD4,XQD5
+22 QUIT