Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. 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 Professional 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 May 15th, 2006, 05:08 AM
Registered User
Points: 1,897, Level: 17
Points: 1,897, Level: 17 Points: 1,897, Level: 17 Points: 1,897, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2005
Location: Mumbai, Maharastra, India.
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rupen
Default Date conversion from querystring.

Hi All,

I have to get date value from query string.
I use below code:
-----------------------
dim dtFrom
if Request.querystring("dtFrom") = "" then
    dtFrom = CDate(date()-1)
else
    dtFrom = Request.querystring("dtFrom")
end if

----------- error at this line:
wday = DateDiff("d",Cdate(Cstr(dtFrom)),Cdate(Cstr(dtTo)) )

----------------------
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'CDate'

Thanks in advance.


Rupen Anjaria.:)
------------------
We CAN'T avoid problems, but can solve it.
  #2 (permalink)  
Old May 15th, 2006, 06:31 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

There uis nothing wrong with your code, this works (cut n paste):

dim dtFrom,dtTo,wDay
dtFrom = CDate(date()-1)
dtTo = CDate(date()+2)
wday = DateDiff("d",Cdate(Cstr(dtFrom)),Cdate(Cstr(dtTo)) )
response.write "the difference is <b>" & wday & "</b> days"

Your problem is the dtFrom value. Use the isDate function to check, can it be a date

Wind is your friend
Matt


Similar Threads
Thread Thread Starter Forum Replies Last Post
year to date conversion rajesh_css Pro Java 1 November 11th, 2008 01:41 AM
problem with date conversion hertendreef SQL Server 2005 0 August 20th, 2007 02:49 PM
Date Conversion ashokparchuri General .NET 2 May 31st, 2005 01:26 AM
Date conversion AFK SQL Language 2 February 4th, 2005 05:14 PM
Date conversion lily611 General .NET 6 December 6th, 2004 12:41 AM





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