Results 1 to 2 of 2

Thread: Date Comparison

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2004
    Posts
    12

    Date Comparison

    If I want to only view records in between 2 dates, say everything between now and the last 7 days how would one write the code for that? I was reading the datediff information in the book I have but it only explained how to do it if you specified the 2 dates say:

    DateDiff(DateInterval.Day, DateTime.Now, DateTime2)

    where DatTime2 has to be a set date in the code or gotten from an input box, etc... Is there a way to tell it to go back 7 days from the first value?

    Thanks ahead of time for any help!

  2. #2

    Thread Starter
    New Member
    Join Date
    Apr 2004
    Posts
    12

    YEAH!!!!

    Great!!! I solved my own problem, to get the date range I wanted I used the following code:

    If fields(0) < DateTime.Now And fields(0) > DateTime.Now.AddDays(-7) Then

    whatever......

    end if

Posting Permissions

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



Click Here to Expand Forum to Full Width