A help request:

Is there a way of returning the current month as a number?

Using DATE$ obviously returns the month name, but that is language
dependent. It would be fairly easy to use a piece of code like:

lang=LANGUAGE
dte$=DATE$
month$=dte$(6 TO 8)
SEL ON lang
=1,44:month_no=month$ INSTR 'JanFebMarAprMayJunJulAugSepOctNovDec': 
rem English
=33:month_no=month$ INSTR 'JanFévMarAvrMaiJunJulAoûSepOctNovDéc' : rem 
French
=49:month_no=month$ INSTR 'JanFebMärAprMaiJunJulAugSepOktNovDez' : rem 
German
=39:month_no=month$ INSTR 'GenFebMarAprMagGiuLugAgoSetOttNovDic' : rem 
Italian
=34:month_no=month$ INSTR 'EneFebMarAbrPueJunJulAgoSepOctNovDic' : rem 
Spanish
rem and so on for all languages supported
END SEL
month_no=(month_no-1) DIV 3

Seems so clumsy I'm sure there must be a better way! I need to use it 
in my diary program to find entries for the current day or current 
month. The only other idea I've come up with so far is to take the 
value of DATE as seconds from DATE=0 and try to divide by the number 
of seconds per year and per month, taking into account leap years! 
Almost as clumsy. I suppose the month number probably exists somewhere 
in the OS to select which month name to take from the language 
dependent modules.

(Incidentally, easy way to crash QPC2 and sometimes take Windows with 
it...SDATE 0,0,0,0,0,0, not that you'd want to!)

So...help, please!

-- 
Dilwyn Jones




-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.12.4/448 - Release Date: 14/09/2006

_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to