If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Datediff function help!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-17-03, 12:55
zw^ zw^ is offline
Registered User
 
Join Date: Oct 2003
Location: Singapore
Posts: 31
Datediff function help!

I have to date field
Startdate:
EndDate

How to use EndDate - StartDate????
Datediff function allow you to chose 1 date variable only
mine have to enter 2 date
how?????
Reply With Quote
  #2 (permalink)  
Old 10-17-03, 12:56
zw^ zw^ is offline
Registered User
 
Join Date: Oct 2003
Location: Singapore
Posts: 31
Re: Datediff function help!

Quote:
Originally posted by zw^
I have to date field
Startdate:
EndDate

How to use EndDate - StartDate????
Datediff function allow you to chose 1 date variable only
mine have to enter 2 date
how?????
I have 2 date field
Startdate:
EndDate:

How to use EndDate - StartDate????
Datediff function allow you to chose 1 date variable only
mine have to enter 2 date
how?????
Reply With Quote
  #3 (permalink)  
Old 10-17-03, 13:42
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
Re: Datediff function help!

Quote:
Originally posted by zw^
I have 2 date field
Startdate:
EndDate:

How to use EndDate - StartDate????
Datediff function allow you to chose 1 date variable only
mine have to enter 2 date
how?????
DateDiff takes at least 3 parameters:

DateDiff(<datepart>, <date1>, <date2>)

Datepart is a character representing the part of the date to return the value a (YYYY = Year, Q = Quarter, M = Month, D = Day, W = Weekday, WW = Week, H = Hour, N = Minute, S = Second)

Date1 is the first date in the comparison.

Date2 is the second date in the comparison.

Code:
Response.Write DateDiff("YYYY", Now, "1/1/2000")
That should return "3" (if it's negative, just switch the dates)
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #4 (permalink)  
Old 10-17-03, 13:46
zw^ zw^ is offline
Registered User
 
Join Date: Oct 2003
Location: Singapore
Posts: 31
but mine have to enter the 2 date from the form because i have a form for people to submit their startdate and enddate.
Reply With Quote
  #5 (permalink)  
Old 10-17-03, 13:50
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
Quote:
Originally posted by zw^
but mine have to enter the 2 date from the form because i have a form for people to submit their startdate and enddate.
Ok...

Code:
Dim dtStartDate, dtEndDate

dtStartDate = Request.Form("StartDate")
dtEndDate = Request.Form("EndDate")

Response.Write DateDiff("N", dtStartDate, dtEndDate)
That should show the numbers of minutes between the two dates...
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #6 (permalink)  
Old 10-17-03, 13:55
zw^ zw^ is offline
Registered User
 
Join Date: Oct 2003
Location: Singapore
Posts: 31
thanks Seppuku
Reply With Quote
  #7 (permalink)  
Old 10-17-03, 14:14
zw^ zw^ is offline
Registered User
 
Join Date: Oct 2003
Location: Singapore
Posts: 31
Seppuku can ask u if i wan to dispkay the price of the car wat should i do ?

i got 2 table rental and car.
rental contain the particulars of member and the car they chose to rent
car contain the car_no, model and daily rate.
how to retrieve daily rate from database??????

i write response.write(oRS("Daily Rate"))
but this error appear
ADODB.Recordset error '800a0cc1'

Item cannot be found in the collection corresponding to the requested name or ordinal.

Last edited by zw^; 10-17-03 at 14:18.
Reply With Quote
  #8 (permalink)  
Old 10-17-03, 14:19
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
Can you post the whole ASP code including the database connection code?
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #9 (permalink)  
Old 10-17-03, 14:27
zw^ zw^ is offline
Registered User
 
Join Date: Oct 2003
Location: Singapore
Posts: 31
for my car table , i never do connection
i just create a car table and display all the car in another page.
Reply With Quote
  #10 (permalink)  
Old 10-17-03, 14:40
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
Quote:
Originally posted by zw^
for my car table , i never do connection
i just create a car table and display all the car in another page.
I'm not sure I understand.. if you can, it would be helpful to see some code
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #11 (permalink)  
Old 10-17-03, 14:46
zw^ zw^ is offline
Registered User
 
Join Date: Oct 2003
Location: Singapore
Posts: 31
It is now working, Thanks anyway for your help .
Thanks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On