Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Array of Month Days
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00702954
Message ID:
00702976
Vues:
10
Thre's a simpler way to get first day of the month.
ldFirstDay = ldDate - Day(ldDate)+1
It's also unaffected by VFP date/time settings, like SET DATE TO ..., e.t.c

>Try this setting ldDate for the date that you want to create the array for -
>
>
>LOCAL ldDate, ldFirstDay, lnBeg, lnEnd, lnCount
>
>ldDate = DATE()
>ldFirstDay = CTOD(STR(MONTH(ldDate)) + "/01/" + STR(YEAR(ldDate)))
>lnBeg = DOW(ldFirstDay)
>lnEnd = lnBeg + DAY(GOMONTH(ldFirstDay, 1) - 1) - 1
>DIMENSION laArray[lnEnd]
>
>IF lnBeg > 1
>  FOR lnCount = 1 TO lnBeg
>    laArray[lnCount] = 0
>  ENDFOR
>ENDIF
>
>FOR lnCount = lnBeg TO lnEnd
>  laArray[lnCount] = lnCount - lnBeg + 1
>ENDFOR
>
>
>HTH
>
>Dan
>
>>I need to create an array of month days. I need the array to start with 1 and if the first day of the month is not a Sunday array(1) = 0 etc.. until the first day matches loop value then number rest of days sequencually.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform