Date Problem!!!

Results 1 to 2 of 2

Thread: Date Problem!!!

  1. #1
    Join Date
    Dec 1969

    Default Date Problem!!!

    My problem here is i only want to compare the month and day, and igonore the year. the coding below can use to compare the date, but i wish to ignore the year comparing. Pls help me to edit.<BR><BR> &#039executed sql statement wihch will show the day and month<BR> which greater than 3/24, for examample.<BR><BR> date1=objRst.Fields(17)<BR> date2= currentdate<BR> if (datediff("d", date1, date2) =0 ) then<BR> <BR> &#039execute another sql statement to show the record which <BR> is &#062;3/24<BR><BR><BR>i need it urgently.Thanks, louis<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Date Problem!!!

    hmmm... don&#039t know why this is in the Performance forum... but...<BR><BR>You can use the Month(someDate) and Day(someDate) functions to grab just the month and date of a datefield. So:<BR><BR>If Month(date1) &#060; Month(date2) then<BR>&#039date1 less than date2<BR>elseif Day(date1) &#060; Day(date2) then<BR>&#039date1 less than date2<BR>else<BR>&#039date1 &#062;= date2<BR>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