472,350 Members | 1,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,350 software developers and data experts.

Get Previous 6 Months

Hi All

I have searched for a solution to this for quite some time but have yet to find one, I'm sure it's quite a basic solution in reality.

Basically, I have an ASP reporting script which I would like to query MSSQL to grab data based on the last six months, I have coded the SQL already but I simply need to pass it a @FromDate and a @toDate for each month.

Is is possible in asp to generate these for the last 6 months.. e.g.

01-01-2007 - 01-31-2007
02-01-2007 - 02-28-2007
etc.. etc..

Thanks in advance for any help!

Mar 28 '07 #1
1 1186
As far as i know asp doesnt have any function to do this automatically..what you can do is pass the day,month and year through intermediate function before you can pass @fromdate,@todate.
GetDateForMonth(ByVal Month As Integer, ByVal Day As Integer)
Select Case Month
Case 2 : If Day > 28 Then Day = 28
Case 9, 4, 6, 11 : If Day > 30 Then Day = 30
End Select

same for the year as well if month=1 then year-1
this should solve your problem
Mar 30 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Finlay | last post by:
Hi Group I am designing a report that should show a meter reading for each month and the previous meter reading for the previous month. The...
by: John A. | last post by:
I've received this error several times, and have only been able to get around it by deleting the offending form(s) and importing them from backup -...
by: tamilan71 | last post by:
Hello Everybody With regard to the same query, I have another problem and I just dont understand where am I going wrong and I m not getting the...
by: karibel | last post by:
I have created a form in MS Access which updates some files for each month. I would like to archive the files of previous months and keep them as...
by: craigfr | last post by:
I want to create a graph (automatically in a report) which compares the current year's values to the previous years by plotting two lines on one...
by: drkknightbatman | last post by:
Hi, I am pretty new to Access 2003 and SQL. I am trying to have a count show up in a query to show specific barcode prefix data between the first and...
by: guyborn | last post by:
I have been trying to get data from the database from the of the previous month to the second last week of the current month.I only managed to get...
by: AccessHunter | last post by:
I have a query that has the following fields/data, ID, Seq, EDate, TDate; 3228, 1, 6/30/2008, 8/7/2008 3228, 1, 6/30/2008, 6/18/2008 3228,...
by: gimme_this_gimme_that | last post by:
Is there a way to get the last day of the previous business quarter from DB2? For 10/21/2008 the day would be 9/30/2008. Thanks.
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.