On 18 Sep 2006 at 17:17, Dilwyn Jones wrote: > A help request:
Hope this helps : DEFine FuNction make_all_months$ rem this makes a string "JanFeb..." in the current language rem this should be called during the initialisation part rem eg. all_months$=make_all_months$ LOCal string$,lp%,a$,temp string$="":a$="":temp=0 temp=60*60*24*31 FOR lp%=0 TO 11 a$=DATE$(lp%*temp) string$=string$&a$(6 TO 8) END FOR lp% RETurn string$ END DEFine make_all_months$ : DEFine FuNction make_date$(dflag%,what_date) rem returns date as "01.01.1991" (dflag%=1) or "1991.01.31" (dflag%=0) rem if what_date<>0, then it is this date that will be returned rem this presumes that a variable "all_month$" exists! LOCal a$,b$,res b$="" IF what_date a$=DATE$(what_date) : rem make date passed as param into string ELSE a$=DATE$ : rem current date into string END IF b$=a$(6 TO 8) : rem 3 letter month abbreviation res= b$ INSTR all_months$ : rem find it IF NOT res all_months$=make_all_months$ : rem not found?, make all_month$ res= b$ INSTR all_months$ : rem and retry END IF res=(res+2)/3 : rem this is the month in figures b$=res:IF res<10:b$="0"&b$ : rem add leading 0 if necessary IF dflag%:RETurn a$(10 TO 11)&"."&b$&"."&a$(1 TO 4) RETurn a$(1 TO 4)&"."&b$&"."&a$(10 TO 11) END DEFine make_date$ : Should be self eplanatory. Wolfgang -- W. H. Lenerz www.scp-paulet-lenerz.com -- _______________________________________________ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm