Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get the Week Number by Month and Week
Message
De
25/08/2017 19:38:23
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01653756
Message ID:
01653759
Vues:
61
Hi Dmitry,
( according to your specs ), maybe this can work for you:
*--------------------------------------------
parameters nYear,nMonth,nWeek,nFirstDayOfWeek

nFirstDayOfWeek = evl(m.nFirstDayOfWeek,set('fdow'))

fd = date(m.nYear,m.nMonth,1)

dowk = dow( m.fd, m.nFirstDayOfWeek )

fd =  m.fd + iif(m.dowk # 1, ( 7 - m.dowk ) + 1,0)

fdd = m.fd + ( ( m.nWeek-1 ) * 7 )
weekn = week( m.fdd , 3, m.nFirstDayOfWeek )

*!*	text to mm textmerge 
*!*	month <<m.nMonth>> of <<m.nYear>>:
*!*	first <<cdow(m.fd)>> is <<m.fd>>
*!*	week <<m.nweek>> of month <<m.nmonth>> starts on <<m.fdd>>
*!*	week( <<m.fdd>>,3,<<m.nFirstDayOfweek>>) returns <<m.weekn>>
*!*	endtext

return m.weekn
@nfoxdev
github.com/nfoxdev
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform