.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Getting records that 7 days pass today's date

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :ASP.Net

I want to get all records that are 7 days pass today's date and not equal to today's date.  Don't know how to write it so I can get records 7 days old but with this procedure I'm still getting records that are due today.  Hope this makes sense.  Can someone assist me.

select * from libraryrequest
where  duedate > getdate() and duedate != getdate()

View Complete Post

More Related Resource Links

dropdownbox which selects records based on criteria (TODAY, THIS WEEK, THIS MONTH, etc)


I have a dropdownbox which I want to use to search records based on a timescale. The gridview populates results based from that search.

So here is how I want to work this;

If a user selects "today" - a list of records input today are populated. If "this week" is selected, a list of all records added within that week from todays date is populated.

I created a forum on this issue previously but to no avail whatsoever. How do I work around this problem?

Help would be much appreciated

How to add days in date using javascript


Hi following is the javascript code which i used for adding days to date

my date is 25/08/2010  and i want to add 8 days to this date  the answer should be 03/09/2010. how it is possible. i tried following code but showing error.



<script type="text/javascript" language="javascript">

function check()
var myDate = new Date();
var vFormat="MM/dd/yyyy";
var vDay                = addZero(myDate.getDate()); 
var vMonth            = addZero(myDate.getMonth()+1); 
var vYearLong         = addZero(myDate.getFullYear()); 
var vYearShort        = addZero(myDate.getFullYear().toString().substring(3,4)); 
var vYear             = (vFormat.indexOf("yyyy")>-1?vYearLong:vYearShort) 
var vHour             = addZero(myDate.getHours()); 
var vMinute           = addZero(myDate.getMinutes()); 
var vSecond           = addZero(myDate.getSeconds()); 
var myDateString       = vFormat.replace(/dd/g, vDay).replace(/MM/g, vMonth).replace(/y{1,4}/g, vYear) 
myDateString           = myDateString.replace(/hh/g, vHour).replace(/mm/g, vMinute).replace(/ss/g, vSecond) 

function addZero(vNumber){ 
    return ((vNumber < 10) ? "0" : "") + vNumber 


select records within 30 days of previous records

I have a table with a list of patient id's and there begin date and end dates as follows: ID     begin_date  end_date 1234 10/09/2009 10/16/2009 1234 12/16/2009 12/22/2009 1234 12/28/2009 12/30/2009 1234 01/13/2010 01/19/2010 1234 04/29/2010 05/05/2010 what i need to do is select the records that have an end_date within 30 days of a begin_date. So in the above example, i would need to get the following records: ID     begin_date   end_date 1234 12/28/2009   12/30/2009 1234 01/13/2010   01/19/2010 Because 12/28/2009 is 30 days within 12/22/2009 (previous end_date) and 01/13/2010 is within 30 days of 12/30/2009 (previous end_date) and 12/22/2009 (2nd previous end_date). is there a good way to do this using T-SQL?

Latest Records depending on Last Modified Date

Hi there,             I have to get the latest records from the table depending on Last Modified date. Table: ID  Function   Apply        Approved    Withdrawn   LastModifiedDate 1    Coding    1/1/2010   15/1/2010   21/1/2010     21/1/2010 3:58:23 1    Coding    1/1/2010    NULL           NULL           21/1/2010 4:58:23 2    Testing    1/1/2010   15/1/2010   21/1/2010    21/1/2010 3:58:23 3    Analysis  1/1/2010    NULL           NULL           21/1/2010 4:58:23   Output is needed on the basis of last modified date if same fucntion comes more than 1 time. else all other functions need which appears once in table. ID  Function  Apply      Approved    Withdrawn        LastModifiedDate 1    Coding   1/1/2010    

rendering today's date through DVWP and modifying the XSLT

I need the Current date or Today to do some simple calculations(calculated columns) such as this: =IF(AND([Due Date]< [today], [today] < ”[Due Date]”),”Red”, “Green”) Question is: To can I convert the above formula so that it works in XSL modifying the XSLT. I new at this and not sure about the syntax. Can anyone help? I am thinking it would be something like this: <xsl:choose> <xsl:when test="ddwrt:Today() &gt; @DueDate"> <xsl:text>Red</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>Green</xsl:text> </xsl:otherwise> </xsl:choose> Obviously something is wrong with the code above...i don't get anything in return.   Thanks Cnothing for members to see

Get last seven days records excluding Weekend days ?

Hi , I'm trying to extract records from table inserted in last seven working days . I'm unable to exclude Sunday and Saturday from this : select * from tb_Name where dt >=DateAdd(dd, DateDiff(dd, 0, Getdate()), 0) and dt<DateAdd(dd, DateDiff(dd, 0, GetDate())-7, 0) Any pointers would greatly  be valued and appreciated . Thanks .Rajkumar Yelugu

Ajax Calendar Extender Question (about disable pass date)

HiI am wondering if it has anyway to disable the past day on the Ajax Calendar Control, previously, when we use CalendarExtender, we need to put a asp:Calendar and a textbox. we can use FindControl to find the calendar control and disable the past days.I am wondering is there anyway  could do the same stuff?Another question is how could I read the user selected date to the Date variable?Do i need to convert the date from the TargetControl ? E.g. Convert.ToDateTime(txt_DATE.text) ?Please let me know if you want me to explain more.Many thanksChi 

How i can view last 5 days records in current Month

Suppose i have a tableAppno Receive_Date Send_Date 1 9/3/2010 9/3/2010 2 9/3/2010 null 3 9/4/2010 9/4/2010 4 9/9/2010 9/9/2010 i m trying to run this select * from search where datediff(d,send_Date,getdate()<5

MOSS 2007 Calculate Due Date including working hours and working days

Hi, I've searched many forums for an answer to my problem but with very limited success. Basically, I've created a Sharepoint list where I would like to track a resolution of incidents versus SLA timings. I have a column with a receiving date, which is a date when the request was submitted and another column with priority code where I have 3 possible values: low (5 working days to close the request), medium (3 days) and high (1 day). What I would like to do is to automatically calculate due date for solving the incident based on the receiving date and the priority code. The thing is that now it is getting more complicated since I need to exclude saturdays and sundays from calculation, as well as national holidays. Then I would like to take into account working hours (from 8am to 4pm), for example if an incident with medium priority was submitted on Friday 5pm, then it would have its due date set to Wednesday 4pm (the request was sent after working hours so we have 3 full working days to complete it) Not sure if it is feasible to achieve using formulas, maybe some other way?

To Pass date in view at runtime!! Can anyone help Very Urgent

Hey I have to pass the Bussiness date in my query at run time I have tried the query below but not able to Execute it. Select * from table name where and RT.BUSINESS_DATE = ? --if only one date --if between two dates and RT.BUSINESS_DATE Between ? and ? Can Any one help me with the Syntax. Will be greatfull!!!

Unble to pass date parameter to "Go to Report " ?


Hi ,

I have Report A need to go from Report A to Report B passing multivalued parameter and date parameter as well , I do not have any problem passing  Multivalued parameter but cant pass date parameter from Report A and Report B .

Report A : Date parameter properties

name : date

Data Type : Date/Time

Default value =Today()

Report B : Date parameter properties

name : date

Data Type : Date/Time

Default value =Today()

Go to Report action ,Expression used to pass date parameter  from Report A to Report B


Unable to pass appropriate date parameter if changed from default value from ReportA to ReportB .

Assistance would highly be appreciated !!

Thanks .

Rajkumar Yelugu

return records based on current date?


I tried finding a QA which already addressed this idea, but with no luck. Sorry if it's been addressed before.


I have a table where sales pricing is managed; it contains history of pricing where every price record has an 'effective date'. Currently when a user needs the 'active' price for a customer/item combination, the table is queried by the record that has the most recent 'EffectiveDate' before GETDATE(). Here is the def for table 'tim_PriceSheet'

ItemKey int, not null

EffectiveDate datetime, notnull

CurrID varchar(3)

ListPrice decimal (15,5)

The primary key is set on ItemKey, EffectiveDate

Sample Data:


ItemKey	EffectiveDate	    CurrID	ListPrice
45	2010-07-01 00:00:00.000	CAD	100.00000
45	2010-09-14 00:00:00.000	CAD	110.00000
45	2010-10-01 00:00:00.000	CAD	112.00000
63	2010-09-01 00:00:00.000	CAD	45.00000
63	2010-09-01 00:00:00.000	USD	45.00000
63	2010-09-18 00:00:00.000	CAD	40.00000
63	2010-10-01 00:00:00.000	USD	40.00000
63	2010-10-15 00:00:00.000	CAD	41.00000
63	2010-10-21 00:00:00.000	USD	41.00000

My challenge is this:

I want to return a record set which shows the current price for each distinct item and currency code; in the example below the result would be based on the date being September 16, 2010

Workflow SPD: Set Today Date+Time to Column-field




I have a little question about settings specific today (Date + Time) value to a field/column within a workflow that is designed by Sharepoint Designer 2007.


I can manage to set the field to today() => but the time is always 00:00 houres.

I would like to set a specific field to the "exact" date+time when the workflow is running. (so choosing a fixed date+fixed Time isn't a solution either)


So I anyone could help me how I can do such "simple" task, I would be very pleased.






Add days to a date field

How do I make a second date field that has a date 90 days greater than the
date in the first date field?

query wich returns records for each day between start date from table 1 and mutation dates in table



I have to tables with dates, table Employments with all employements of all employees, with start date and end date, and a table Mutations with mutations (e.g in salary) with start dates.

Now I try to write a query which returns a record for each day an employee is in employment, with the correct salary. SO at first, it should return all days between the employment start date and the first mutation date, then the number of days between the first mutation date and the second mutation date etcetc, and at last the number of days between the last mutation date and the employment end date. The number of mutations varies for each employment, and employees cna have multiple employments (history, so not at the same time) in the employments table.

How to do this?

how can i stop to add records if date is....


I have two table

column name: Userid, courseno,roomname


column name: coursestartdate,courseenddate,courseno etc...

I want that, User cannot register to course if he already registered in between dates of other course

I want like,if user registers for course,
for example coursename: sql server

startdate: 10/10/2010
end date:10/11/2010

after registration for this course
if hwe tries to register for another course which startdate or end date must not be inbetween 10/10/2010 and 10/11/2010


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend