calculate date

Results 1 to 2 of 2

Thread: calculate date

  1. #1
    Join Date
    Dec 1969

    Default calculate date

    I have written where a user is able to retrieve information by selecting certain date ranges. Such as this week, last week, yesterday last month. I am unable to get last week to work. It works if I am in the same year. For example, I am in 1/2/02 and I want to get last week information which will be 12/23/01 - 12/29/01. I don&#039;t get any information. This is white I have: <BR>DATEPART(WW,LOGONTIME)= DATEPART(WW,GETDATE())-1 and DATEPART(YY,LOGONTIME)= DATEPART(YY,GETDATE())<BR>Any suggestions?<BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default That's what you told it to do...

    Your problem is exactly what you have written.<BR><BR>You say:<BR>"I want records where:<BR>The week part of the time is the same as last week, AND<BR>The year part of the time is the same as THIS YEAR"<BR><BR>Change the last part of the query.<BR><BR>Craig.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts