source: WorldVistAEHR/trunk/r/ZZREGIONAL-A1C-A5C-CRHD-RGED-RGUT-RGWB-RG/RGUTDT.m@ 862

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

initial load of WorldVistAEHR

File size: 1.6 KB
Line 
1RGUTDT ;CAIRO/DKM - FM date to formatted date;04-Sep-1998 12:46;DKM
2 ;;2.1;RUN TIME LIBRARY;;Mar 22, 1999
3 ;=================================================================
4 ; Inputs:
5 ; RGDAT = date to format (DHCP format or $H format)
6 ; RGFMT = date and time format control (optional)
7 ; xxx0 = dd-mmm-yyyy
8 ; xxx1 = mmm dd,yyyy
9 ; xxx2 = mm/dd/yyyy
10 ; xxx3 = mm-dd-yyyy
11 ; xx0x = hh:mm
12 ; xx1x = hh:mm xx
13 ; x0xx = use space to separate date/time
14 ; x1xx = use @ to separate date/time
15 ; 0xxx = allow leading zeros
16 ; 1xxx = remove leading zeros
17 ; Outputs:
18 ; Returns formatted date
19 ;=================================================================
20ENTRY(RGDAT,RGFMT) ;
21 S RGDAT=$G(RGDAT,$H)
22 Q:'RGDAT ""
23 N RGZ1,RGZ2,RGZ3,RGZ4,RGDLM,RGTM
24 S:RGDAT?1.N1",".N RGDAT=$$HTFM^XLFDT(RGDAT)
25 S RGFMT=$G(RGFMT)#100000,RGFMT=RGFMT#10000,RGZ4=RGFMT\1000,RGFMT=RGFMT#1000,RGDLM=$S(RGFMT>99:"@",1:" "),RGFMT=RGFMT#100,RGTM=RGFMT\10,RGFMT=RGFMT#10
26 I RGDAT\1 D
27 .S RGZ3=RGDAT\1+17000000,RGZ1=$E(RGZ3,7,8),RGZ2=$E(RGZ3,5,6),RGZ3=$E(RGZ3,1,4)
28 .S:RGZ4 RGZ1=+RGZ1,RGZ2=+RGZ2
29 .S:RGFMT<2 RGZ2=$P("Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",",",RGZ2)
30 .S RGZ1=$S('RGFMT:RGZ1_"-"_RGZ2_"-"_RGZ3,RGFMT=1:RGZ2_" "_RGZ1_","_RGZ3,RGFMT=2:RGZ2_"/"_RGZ1_"/"_RGZ3,1:RGZ2_"-"_RGZ1_"-"_RGZ3)
31 E S RGZ1=""
32 S RGZ2=RGDAT#1*10000+10000\1
33 I RGZ2=10000!(RGZ2>12400) S RGZ2=""
34 E D
35 .S:RGTM RGZ2=$S(RGZ2=12400:RGZ2-1200_" am",RGZ2>11299:RGZ2-1200_" pm",RGZ2>11199:RGZ2_" pm",RGZ2<10099:RGZ2+1200_" am",1:RGZ2_" am")
36 .S RGZ3=$S(RGZ4:+$E(RGZ2,2,3),1:$E(RGZ2,2,3)),RGZ2=RGZ3_":"_$E(RGZ2,4,8)
37 Q RGZ1_$S('$L(RGZ2):"",$L(RGZ1):RGDLM,1:"")_RGZ2
Note: See TracBrowser for help on using the repository browser.