[613] | 1 | XLFDT1 ;ISC-SF/RWF - Date/Time Functions cont. from VA FileMan %DTC ;02/20/2003 10:05
|
---|
| 2 | ;;8.0;KERNEL;**71,280**;Jul 10, 1995
|
---|
| 3 | ;If y contains a "D" then Date only.
|
---|
| 4 | ;if y contains a "F" then output with leading blanks
|
---|
| 5 | ;If y contains a "P" then output ' HH:MM:SS am/pm'.
|
---|
| 6 | ;If y contains a "S" then force seconds in the output.
|
---|
| 7 | ;if y contains a "M" then stop at minutes i.e. no seconds.
|
---|
| 8 | ;
|
---|
| 9 | FMT ;
|
---|
| 10 | N %G S %G=+%F
|
---|
| 11 | G F1:%G=1,F2:%G=2,F3:%G=3,F4:%G=4,F5:%G=5,F6:%G=6,F7:%G=7,F8:%G=8,F9:%G=9,F1
|
---|
| 12 | Q
|
---|
| 13 | ;
|
---|
| 14 | F1 ;Apr 10, 2002
|
---|
| 15 | S %R=$P($$M()," ",$S($E(Y,4,5):$E(Y,4,5)+2,1:0))_$S($E(Y,4,5):" ",1:"")_$S($E(Y,6,7):$E(Y,6,7)_", ",1:"")_($E(Y,1,3)+1700)
|
---|
| 16 | ;
|
---|
| 17 | TM ;All formats come here to format Time.
|
---|
| 18 | N %,%S Q:%T'>0!(%F["D")
|
---|
| 19 | I %F'["P" S %R=%R_"@"_$E(%T,2,3)_":"_$E(%T,4,5)_$S(%F["M":"",$E(%T,6,7)!(%F["S"):":"_$E(%T,6,7),1:"")
|
---|
| 20 | I %F["P" D
|
---|
| 21 | . S %R=%R_" "_$S($E(%T,2,3)>12:$E(%T,2,3)-12,+$E(%T,2,3)=0:"12",1:+$E(%T,2,3))_":"_$E(%T,4,5)_$S(%F["M":"",$E(%T,6,7)!(%F["S"):":"_$E(%T,6,7),1:"")
|
---|
| 22 | . S %R=%R_$S($E(%T,2,7)<120000:" am",$E(%T,2,3)=24:" am",1:" pm")
|
---|
| 23 | . Q
|
---|
| 24 | Q
|
---|
| 25 | ;Return Month names
|
---|
| 26 | M() Q " Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"
|
---|
| 27 | ;
|
---|
| 28 | F2 ;4/10/02
|
---|
| 29 | S %R=$J(+$E(Y,4,5),2)_"/"_$J(+$E(Y,6,7),2)_"/"_$E(Y,2,3)
|
---|
| 30 | S:%F["Z" %R=$TR(%R," ","0") S:%F'["F" %R=$TR(%R," ")
|
---|
| 31 | G TM
|
---|
| 32 | F3 ;10/4/02
|
---|
| 33 | S %R=$J(+$E(Y,6,7),2)_"/"_$J(+$E(Y,4,5),2)_"/"_$E(Y,2,3)
|
---|
| 34 | S:%F["Z" %R=$TR(%R," ","0") S:%F'["F" %R=$TR(%R," ")
|
---|
| 35 | G TM
|
---|
| 36 | F4 ;02/4/10
|
---|
| 37 | S %R=$E(Y,2,3)_"/"_$J(+$E(Y,4,5),2)_"/"_$J(+$E(Y,6,7),2)
|
---|
| 38 | S:%F["Z" %R=$TR(%R," ","0") S:%F'["F" %R=$TR(%R," ")
|
---|
| 39 | G TM
|
---|
| 40 | F5 ;4/10/2002
|
---|
| 41 | S %R=$J(+$E(Y,4,5),2)_"/"_$J(+$E(Y,6,7),2)_"/"_($E(Y,1,3)+1700)
|
---|
| 42 | S:%F["Z" %R=$TR(%R," ","0") S:%F'["F" %R=$TR(%R," ")
|
---|
| 43 | G TM
|
---|
| 44 | F6 ;10/4/2002
|
---|
| 45 | S %R=$J(+$E(Y,6,7),2)_"/"_$J(+$E(Y,4,5),2)_"/"_($E(Y,1,3)+1700)
|
---|
| 46 | S:%F["Z" %R=$TR(%R," ","0") S:%F'["F" %R=$TR(%R," ")
|
---|
| 47 | G TM
|
---|
| 48 | F7 ;2002/4/10
|
---|
| 49 | S %R=($E(Y,1,3)+1700)_"/"_$J(+$E(Y,4,5),2)_"/"_$J(+$E(Y,6,7),2)
|
---|
| 50 | S:%F["Z" %R=$TR(%R," ","0") S:%F'["F" %R=$TR(%R," ")
|
---|
| 51 | G TM
|
---|
| 52 | F8 ;10 Apr 02
|
---|
| 53 | S %R=$S($E(Y,6,7):$E(Y,6,7)_" ",1:"")_$P($$M()," ",$S($E(Y,4,5):$E(Y,4,5)+2,1:0))_$S($E(Y,4,5):" ",1:"")_$E(Y,2,3)
|
---|
| 54 | G TM
|
---|
| 55 | F9 ;10 Apr 2002
|
---|
| 56 | S %R=$S($E(Y,6,7):$E(Y,6,7)_" ",1:"")_$P($$M()," ",$S($E(Y,4,5):$E(Y,4,5)+2,1:0))_$S($E(Y,4,5):" ",1:"")_($E(Y,1,3)+1700)
|
---|
| 57 | G TM
|
---|