Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Array of Month Days
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00702954
Message ID:
00702976
Views:
9
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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform