Click to See Complete Forum and Search --> : Asp.net


Jwilliams
August 11th, 2005, 06:53 AM
Asp.net

--------------------------------------------------------------------------------

I am designing a website which uses dates input to calculate the total cost of product, using this code

pdatstart =request.form(txt1)
pdatend=request.form(txt2)
plngwd=datediff(dateinterval.day,pdatstart,pdatend)

but it returns an error saying cast from string to type date is not valid
and how can i use it to calculate for the cost in the shopping basket.

Thanxx

TSmooth
August 11th, 2005, 07:32 AM
Use either the CDate() or CType() functions to convert your strings to dates first. That should fix your problem.

- Tom