Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
First day of week
Message
From
30/09/2003 10:38:39
 
 
To
30/09/2003 08:59:15
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00833397
Message ID:
00833479
Views:
22
Juan Rossano send me this function in GUFA List.

It Work Ok for me.
function WSemana
lParameters lpSemana, lpAnio
 
if type("lpSemana") # "N" or type("lpAnio") # "N" or not between(lpAnio,1900,9999)
 return {} && Devuelve vacio en caso de error en parametros
endif
 
local lDiaUno, lSemanaUno, lInicioAnio, lInicioDia, lInicioReal, lDiaSemana
 
lDiaUno = set("fdow")
lSemanaUno = set("fweek")
 
lInicioAnio = ctod("01/01/"+padl(lpAnio,4,"0"))
lInicioDia = dow(lInicioAnio)
lInicioReal = lInicioAnio - lInicioDia + lDiaUno
 
do case
case lSemanaUno = 1
 lCantidadSemana = lpSemana - 1
case lSemanaUno = 2
 lCantidadSemana = iif(lInicioAnio-lInicioReal>3,lpSemana,lpSemana-1)
case lSemanaUno = 3
 lCantidadSemana = iif(lInicioAnio>lInicioReal,lpSemana,lpSemana-1)
otherwise
 lCantidadSemana = 0
endcase
 
lDiaSemana = lInicioReal + 7 * lCantidadSemana - day(lInicioAnio) + 1
 
return lDiaSemana
Regards,
José Luis.

Quidquid latine dictum sit, altum sonatur

Previous
Reply
Map
View

Click here to load this message in the networking platform