Re: Week # function?
Posted in 1994
From Edmond Ying: * * Any one know if there is a 4gl function that return the week # * in a year? * Please let me know if you do. Thanks in advance :-) Here is mine: # SNIP ----- SNIP ----- SNIP ----- SNIP ----- SNIP ----- SNIP ----- SNIP ----- ############################################################################## # # This is just an example front end to the function you want. # ############################################################################## MAIN DEFINE weekno SMALLINT LET weekno = get_current_week( TODAY ) DISPLAY "Currently, we are in week: ", weekno, " of the year" END MAIN ############################################################################## # # Find what week we are in for year passed in # ############################################################################## FUNCTION get_current_week( pass_date ) DEFINE pass_date DATE, weekno SMALLINT, start_date DATE LET weekno = 1 LET start_date = mdy( 1, 1, YEAR( pass_date ) ) WHILE start_date + 7 < pass_date LET start_date = start_date + 7 LET weekno = weekno + 1 END WHILE RETURN weekno END FUNCTION # SNIP ----- SNIP ----- SNIP ----- SNIP ----- SNIP ----- SNIP ----- SNIP ----- Hope this helps, #----------------------------------------------------------------------------- Robert Minter |Data Systems Support| \\\\\\_/// Programmer, Software Development | Orange, CA | ( _ _ ) internet: rob@dssmktg.com | Tel: 714.771.0454 | (| ^ |) bangpath: uunet.uu.net!dssmktg!rob| Fax: 714.771.3028 | \\`-'/ I used to not know, now I know I don't know. \\_/