Print Page | Close Window

Result for month (s) ago

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=6740
Printed Date: 31 March 2026 at 3:07pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Result for month (s) ago
Posted By: ngaisteve1
Subject: Result for month (s) ago
Date Posted: 26 October 2003 at 10:06pm
let's say I have a combo box with value one month, two month and three month. When the user select one month, it means that the user want to see all results a month ago. Eg, if today is 25-Oct. When he selects one month, then all result from 25-Sep to 25-Oct. For now, just forget about the special case like Feb or any special case first. Which date function is best apply for this case?

Thank you for all contribution.



Replies:
Posted By: Phat
Date Posted: 26 October 2003 at 10:38pm
Use Dateadd

Adds or subtracts a time interval to a date and gives you back the new date.

Function Name: DateAdd
Syntax:DateAdd(interval, number, date)

interval - can have these values:
d day
h hour
m month
n minute
q quarter
s second
w weekday
ww week of year
y day of year
yyyy year

number is a positive number of time you want to add to the date if number is negative then that number will be subtracted from the date

Example: DateAdd("m", 3, "1-MAY-98")
This example will add 3 months to May 1st 1998

found info at http://www.loudasp.com/KnowledgeBase/showfaq.asp?faqid=784&a mp;catID=28


-------------
http://buildit.sitesell.com/sitebuildithome.html - Get a website that sells


Posted By: ngaisteve1
Date Posted: 27 October 2003 at 2:17am
Thank you so much. It helps.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net