Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 27th, 2006, 03:23 AM
Friend of Wrox
 
Join Date: May 2005
Location: tehran, tehran, Iran.
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hastikeyvan
Default sysntax problem

hello all
I have a problem with Datediff function that i would be very happy if anyone can help me.
can we write such code for calculating datediff of 2 elements in recordset and set the returned value for another element of recordset:
<%rs.movefirst()
        while not rs.eof
        rs("a")=datediff(rs("b"),rs("c"))
        rs.movenext()
        wend%>
thank you

  #2 (permalink)  
Old March 28th, 2006, 12:44 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Melbourne, Vic, Australia.
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The problem with your syntax is that datediff requires 3 parameters:
The format of difference, and the two dates
such as DateDiff("d", Rs("b"), Rs("c"))
check this out, it should give you the answer you need:
http://www.w3schools.com/vbscript/func_datediff.asp

And remember - Google is your friend:
http://www.google.com.au/search?hl=e...datediff&meta=
Try it some time.



I am a loud man with a very large hat. This means I am in charge






Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.