Jump to Real's How-to Main page

Obtain the week of the year

// a week # (1-53) 
Date ld_today, ld_januaryFirst
int  li_year
long ll_weekOfTheYear
dt_today = Today()
li_year = Year(ld_today)
ld_januaryFirst = Date( String( li_year ) + '-01-01' )
ll_weekOfTheYear = Int( ( DaysAfter(ld_januaryFirst, Date(ld_date)) + &
        DayNumber(ld_januaryFirst) ) / 7) + 1

If you find this article useful, consider making a small donation
to show your supportfor this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2005
[ home ]