Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help re Array for Dates

Status
Not open for further replies.

ppedersen1

Technical User
Oct 14, 2002
43
US
How do I create an array for dates between 10/03/02 and 01/02/03. This equals 14 weeks and I want to go through them 7 days at a time (i.e., Step 7). In essence, I am trying to create a date array whereby a number would be input for each of the 14 weeks. So the date would end up looking something like this:
10/03/02 - 55
10/10/02 - 57
10/17/02 - 56

etc. But I want the dates in an array so they are automatic.
Thanks.
 
Check out VBHelp for 'Date and Time functions' and Format function
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Thanks Johnwm. I have tried a couple of manuals so far and I haven't had any luck. However, I shall keep at it.
 

Function BuildArray(dtStartDate As Date, dtEndDate As Date) As String()
Dim dtCurrentDate As Date
Dim aryIntervals() As String
Dim strTemp As String

dtCurrentDate = dtStartDate

Do Until dtCurrentDate > dtEndDate
strTemp = strTemp & " " & dtCurrentDate
dtCurrentDate = dtCurrentDate + 7
Loop

aryIntervals = Split(RTrim$(strTemp))

End Function
[/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top