ASP Date Calculations

# Thread: ASP Date Calculations

1. Senior Member
Join Date
Dec 1969
Posts
287

## ASP Date Calculations

I have asp page, where I can click download button and it downloads the data into excel. However, I have time fields on it, like clock in and clock out. I need to perfom the calculation that would tell me the difference between clock out and clock in and it would be automatic calc once you open excel. <BR>It doesn&#039;t want to do the calculations. Here is the code, I believe I am missing a componenet or format issue.<BR>Thank you for your help.<BR>Petra.<BR><BR>&#060;td&#062;<BR>&#060;% = FormatDateTime(rsProds("clockin"),3) %&#062;&#060;/td&#062;<BR>&#060;td&#062;<BR>&#060;% = FormatDateTime(rsProds("clockout"),3) %&#062;&#060;/td&#062;<BR><BR>&#060;td&#062;<BR>&#060;%=dateAdd( "H",clockout, clockin)%&#062;&#060;/td&#062;<BR>&#060;td&#062;<BR>=sum(d:e)&#060;/td&#062;

2. Senior Member
Join Date
Dec 1969
Posts
1,843

## R&D DateDiff Function <EOP>

.

3. Senior Member
Join Date
Dec 1969
Posts
287

## RE: R&D DateDiff Function <EOP>

What is R&D Date Diff Function?<BR>

4. Senior Member
Join Date
Dec 1969
Posts
1,032

## RE: R&D DateDiff Function <EOP>

R&D= Research and Development<BR>Datediff function = a date difference function<BR><BR>search for datediff in the VB Script Syntax option on your left<BR><BR>jon.<BR><BR><BR>

5. Senior Member
Join Date
Dec 1969
Posts
287

## Did that but returns zero

I did that and changed my code, but it returns 0.<BR><BR>&#060;td&#062;<BR>&#060;% = dateDiff("d",clockout,clockin)%&#062;&#060;/td&#062;<BR><BR>what am i missing. I don&#039;t understand. clockout is date that is recoded in access, same clockin. i need to see the number of hours between the two.<BR>Thank you,<BR>PEtra

6. Senior Member
Join Date
Dec 1969
Posts
1,032

## RE: Did that but returns zero

try,<BR><BR>datediff("h",date1,date2)<BR><BR>se if that works <BR><BR>Jon.

7. Senior Member
Join Date
Dec 1969
Posts
287

## No Doesn't work

No it doesn&#039;t work. Still getting zeros. <BR>Is it even possible to do it?<BR>Petra

8. Senior Member
Join Date
Dec 1969
Posts
1,843

## Probably Not Dates

Yes, These values are probably not dates. use<BR><BR> yourdate = cdate(yourdatehere) <BR><BR>To convert them to dates. I&#039;d do this as soon as you reguest them from the querystring/form because I think you&#039;ll need to do it for the SQL statement we talked about yesterday. <BR><BR>Or, if you&#039;re queryring them from a DB, make sure this field in the DB is set to "Date/Time" data type.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•