Wrox Programmer Forums
|
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
 
Old June 28th, 2004, 01:59 PM
Authorized User
 
Join Date: Feb 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default Date functions and statements

Hi,

I want to display the dates from my database recordsets and view them as separate numbers using the built in object -datepart (works fine!). Then I want to determine if the date is from today, or from yesterday. But the string comparison does not work the way I want it to. Anybody who knows how to pull it of?

Cheers... //Thomas

 
Old June 28th, 2004, 08:16 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

I'm not sure why you wish to pull the date appart but if you still have a reference to the original date, or can put it back together you can use datediff() function.

x = datediff("d",date1,date2)
this will return the number of days between the dates.
0 means today
1 tomorrow
-1 yesterday
etc



======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
 
Old June 28th, 2004, 08:17 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Sorry,
It might be the other way around. (-1 Tomorrow,1 yesterday)
Just try it to see.

======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
 
Old June 29th, 2004, 10:09 AM
Authorized User
 
Join Date: Feb 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You were right. 0 is for today, 1 is for yesterday and -1 is for tomorrow.

Thanks //Thomas






Similar Threads
Thread Thread Starter Forum Replies Last Post
if statements for multiple date checks melkin SQL Language 0 December 17th, 2007 09:53 AM
date functions in xslt1.0 pradeepn XSLT 4 July 26th, 2007 04:28 AM
Date functions Gandalf_the_Grey Classic ASP Basics 2 December 20th, 2006 02:39 AM
SQL date functions frankb522 Other Programming Languages 2 June 24th, 2006 09:04 AM
DATE FUNCTIONS DARSIN General .NET 1 January 14th, 2005 09:11 AM





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