Datediff Problem

T

Tim::.

I am having some difficulties with the function Datediff! I am trying to calculate the number of days between two given date

E.G: Number days between 03-05-2004 and 05-05-2004 =

I am using the following piece of asp to extract dates from an XML document and work with them to create the above mentioned result, however I can't get it to work

Can someone please assist!

Thank

...::XML Exampl
<Project><ProjectID>1</ProjectID><Tasks><Task><TaskID>1</TaskID><Start></Start><Finish></Finish></Task><Task><TaskID>2</TaskID><Start></Start><Finish></Finish></Task></Tasks></Project

...:: AS
<
'Load XM
set xml = Server.CreateObject("Microsoft.XMLDOM"
xml.async = fals
xml.load(Server.MapPath("ProjectTEST.xml")

'Load XS
set xsl = Server.CreateObject("Microsoft.XMLDOM"
xsl.async = fals
xsl.load(Server.MapPath("GantChartView.xsl")

'Finds Start date in all Tasks in xml documen
Dim sNodes(200,100
Dim sDate(200,100
Dim sTime(200,100
Dim sMonth(200,100
Dim sDay(200,100
Dim fdw(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

'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 "sDay " & (sDay(var,0)) & "<br>
'End Break up dates into variable

'Converts dates to beginning of week (Sunday
today = DateValue(sDate(var,0))
var=var+
for i=0 to 9
firstday = today + 1 - weekday(today, 1
fdw (var,i) = firstday

nex
FirstDayWeek = fdw (var,0
response.Write(fdw(var,0)
response.write(DateDiff("D", sDate(var,0), fdw(var,0))
next
 
M

Maarten

In my country 2 is correct. Check the Format or the LCID

Tim::. said:
I am having some difficulties with the function Datediff! I am trying to
calculate the number of days between two given dates
E.G: Number days between 03-05-2004 and 05-05-2004 = 2

I am using the following piece of asp to extract dates from an XML
document and work with them to create the above mentioned result, however I
can't get it to work.
Can someone please assist!

Thanks

..::XML Example
<Project><ProjectID>1</ProjectID><Tasks><Task><TaskID>1</TaskID><Start></Sta
 

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

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top