Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Week array
Message
From
23/09/2002 09:01:58
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
23/09/2002 07:05:52
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00703287
Message ID:
00703321
Views:
13
>Hi all,
>
>I want to create an array with a list of week ending dates (Friday).
>Anyone know the easiest way of doing this?
>
>Thanks in advance,
>
>Ger.
LOCAL ARRAY arrFridays[1]
lnFridays = Days2Array(DATE(),DATE(2003,1,1),6,@arrFridays)
? lnFridays
DISPLAY MEMORY LIKE arrFridays

Function Days2Array
  Lparameters tdStart, tdStop, tnDow, taArray
  Local lnWeeks,ix, lnBase
  lnWeeks = Int((tdStop-(tdStart-Dow(tdStart,tnDow) + 1))/7)
  If tdStart = (tdStart-Dow(tdStart,tnDow) + 1)
    lnWeeks =lnWeeks + 1
    lnBase = -1
  Else
    lnBase = 0
  Endif
  If lnWeeks > 0
    Dimension taArray[lnWeeks]
    For ix = 1 To lnWeeks
      taArray[ix] = tdStart - Dow(tdStart,tnDow) + 1 + 7 * (ix + lnBase)
    Endfor
  Endif
  Return lnWeeks
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform