Annotation of freem/contrib/%uxdat.m, revision 1.1

1.1     ! snw         1: %uxdat(h,format)        ; FreeM Date/Time formatting  - version 0.5.0.1
        !             2:  ; Jon Diamond - 1999-03-21
        !             3:  ;
        !             4:  n time
        !             5:  ;
        !             6:  S h=$G(h) i h="" s h=+$H
        !             7:  s time=$P(h,",",2) i time="" s time=$p($h,",",2)
        !             8:  q $$date(h,$g(format))_"  "_$$time(time,$g(format))
        !             9:  ;
        !            10: date(h,format)   
        !            11:  s format=$g(format)     
        !            12:  n day,h,i,ly,mon,r,year,mm
        !            13:  S h=$G(h) i h="" s h=+$H
        !            14:  s time=$P(h,",",2) i time="" s time=$p($h,",",2)
        !            15:          
        !            16:  s h=h>21914+h ; 1900 IS NOT A LEAP YEAR
        !            17:  S ly=h\1461,r=h#1461,year=ly*4+1841+(r\365),day=r#365,mon=1
        !            18:  I r=1460,ly'=14 S day=365,year=year-1
        !            19:  F i=31,(r>1154)&(ly'=14)+28,31,30,31,30,31,31,30,31,30 Q:i'<day  S mon=mon+1,day=day-i
        !            20:  I day=0 S year=year-1,mon=12,day=31
        !            21:  ; 
        !            22:  S mm=$P("JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC"," ",mon)
        !            23:  I day<10 S day=0_day
        !            24:  I mon<10 S mon=0_mon
        !            25:  i +format=1 q year_"-"_mon_"-"_day
        !            26:  q day_"-"_mm_"-"_year
        !            27:  ; 
        !            28: time(time,format)
        !            29:  S time=$g(time) i time="" s time=$p($h,",",2)
        !            30:  n %TIM,%TIM1,%TIM2,hour,hour2,min,sec
        !            31:  S hour=time\3600
        !            32:  S min=time-(hour*3600)\60
        !            33:  S sec=time-(hour*3600)-(min*60)
        !            34:  S %TIM=hour_":"_(min\10)_(min#10) ; like MSM
        !            35:  S hour2=(hour-1)#12+1
        !            36:  S %TIM1=$J(hour2,2)_":"_(min\10)_(min#10)_" "_$S(hour\13:"PM",1:"AM") ; like MSM
        !            37:  S %TIM2=%TIM_":"_(sec\10)_(sec#10)       
        !            38:  ;       
        !            39:  i +format=1 q %TIM2
        !            40:  q %TIM1
        !            41: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>