Loop or Variable problem???

T

Tim::..

H

Can someone please give me some advice with regards to this piece of ASP i have been trying to construct! It is giving me a bit of a head ache and I think it is because my loops or variables are messed up

I want to use the last line of ASP "response.write(DateDiff("d", sDay(var,0), fdw(var,0)) )" to find the number of days between the start of the week and the Start date given in the XML file

What am I doing wrong??

I also guess there should be a more afficient way to produce the same results as I have here

...:: XM
<Project><Tasks><Task><Start>2004-03-16T08:00:00</Start><Finish>2004-03-18T17:00:00</Finish></Task></Tasks></Project

...::AS
Dim sNodes(200,100
Dim sDate(200,100
Dim sTime(200,100
Dim sMonth(200,100
Dim sDay(200,100
Dim fdw(200,100
'Dim fdnw(200,100
'Dim fdwa(200,100

node=-
var=-

set oNodes=xml.selectNodes("/Project/Tasks/Task/Start"

for each oNode in oNode
node=node+
for i=0 to 9
sNodes(node,i) = oNode.tex
nex

' Write whole data and time for Start of task as seen in XML Documen
'response.Write sNodes(node,0) & "<br>

'Break up date into different variable
var=var+
for i=0 to 9
sTemp = sNodes( node,0
sDate( var,i ) = Mid( sTemp, 1, 10
sTime( var,i ) = Mid( sTemp, 13, 4
sMonth( var,i ) = Mid( sTemp, 6, 2
sDay( var,i ) = Mid( sTemp, 9, 2
next
'response.write (sDate(var,0)) & "<br>
'response.write (sTime(var,0)) & "<br>
'response.write (sMonth(var,0)) & "<br>
response.write "sDay " & (sDay(var,0)) & "<br>
'End Break up dates into variable

'Converts dates to beginning of week (Sunday
'today = Date()
' or
today = DateValue(sDate(var,0))
var=var+
for i=0 to 9
firstday = today + 1 - weekday(today, 1
fdw (var,i) = firstday
'fdnw (var,i) = firstday+
'fdwa (var,i) = firstday+1
nex
FirstDayWeek = fdw (var,0
'response.Write(fdnw (var,0)) & "<BR>
'response.Write(fdwa (var,0)) & "<BR>

'fsDay = Mid( FirstDayWeek, 3, 2
'response.Write(fsDay) & "<BR>
'imgSpaceDay = sDay (var,0)- fsDa
'response.write(imgSpaceDay
response.write(DateDiff("d", sDay(var,0), fdw(var,0))
next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,828
Latest member
LauraCastr

Latest Threads

Top