473,396 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Get Previous 6 Months

1
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!

John
Mar 28 '07 #1
1 1212
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

1
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 months are text stored in a field tMonth. The...
2
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 - Here's the sequence: 1. I'm editing a form or...
0
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 result I need. Following the suggestion given by...
1
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 records that can be accessed. and i don't know how I...
1
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 chart. I have one table which has the fields: ...
3
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 the last day of the previous month. I want to do...
1
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 data from the previous month to today's date. ...
2
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, 1, 6/30/2008, 3/22/2005 3228, 1, 6/30/2008,...
4
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.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.