Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." 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 Basics 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
 
Old March 12th, 2004, 10:20 PM
Authorized User
 
Join Date: Jun 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hcweb
Default Quick If Then Question

Got a quick question..

Is there a between clause that can be used in an If Then statement?

Something like:
If strDate BETWEEN "03/01/2004" AND "04/01/2004" Then
  Response.Write "Something"
Else
  Response.Write "Something Else"
End If

I need to check that a date is "between" 2 dates like above and the If Then statement is pretty much what I need. Any help is greatly appreciated!

Note: Can someone ask a really, really easy question so that maybe I can answer?!? Seems like I'm always asking you guys for help, and not giving anything back. I figure something like "What's ASP stand for?" would do just fine. I think I could handle that one. Yeah.... I could answer that one...

:o)

Chris
 
Old March 13th, 2004, 05:13 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

To tell you the truth I can't rememeber in VBScript but you can use:
Code:
If strDate >= "03/01/2004" AND strDate <= "04/01/2004" Then
However if your strDate is a string you are doing a string comparison, not on the date. If strDate is a Date then you need to make sure your computer interprets "03/01/2004" as the date you intend it to be. Better if you convert it to a date yourself by hand and then test.

--

Joe
 
Old March 13th, 2004, 02:13 PM
Authorized User
 
Join Date: Jun 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hcweb
Default

Ahhh.. I forgot about it may not be an actual date. I'm querying data from an AS/400 and there are times when the data contained in the libraries is actually text when you think it's numeric. Let me try that date conversion and see what happens. Thanks!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick Question! arcadium Java GUI 1 August 5th, 2008 02:16 AM
another quick question andyhague XSLT 2 March 21st, 2006 12:13 PM
quick question treasacrowe Classic ASP Databases 2 August 30th, 2004 08:27 AM
Quick Question Ben Horne Forum and Wrox.com Feedback 1 March 22nd, 2004 03:29 PM





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