b0ris Posted July 15, 2009 Share Posted July 15, 2009 I've already checked the forum, but found nothing useful on comparing 2 dates. What I'm trying to do, is getting a lot of dates from a database using SQL, then check if those are between a start date and an end date I'm entering. Does any of you got any idea how to do this? Thanks in advance for any help! Link to comment Share on other sites More sharing options...
water Posted July 15, 2009 Share Posted July 15, 2009 (edited) Did you have a look at the Date Management UDF? See: Help File -> User Defined Functions -> Date Management. Function _Date_Time_CompareFileTime could do what you want. Edited July 15, 2009 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
b0ris Posted July 15, 2009 Author Share Posted July 15, 2009 Did you have a look at the Date Management UDF? See: Help File -> User Defined Functions -> Date Management. Function _Date_Time_CompareFileTime could do what you want. Thanks for trying to help, but that won't work, or at least I'm not good enough to make it work. The code looks like this now: $aMon=StringMid($tAssigned[$x],4,2) $aDay=StringLeft($tAssigned[$x],2) $aYear=StringMid($tAssigned[$x],7,4) $dateASS=_Date_Time_EncodeFileTime($aMon,$aDay,$aYear) $sMon=StringMid($sDate,4,2) $sDay=StringLeft($sDate,2) $sYear=StringMid($sDate,7,4) $sDate1=_Date_Time_EncodeFileTime($sMon,$sDay,$sYear) $eMon=StringMid($eDate,4,2) $eDay=StringLeft($eDate,2) $eYear=StringMid($eDate,7,4) $eDate1=_Date_Time_EncodeFileTime($eMon,$eDay,$eYear) $date1X=_Date_Time_CompareFileTime($dateASS,$sDate1) $date2X=_Date_Time_CompareFileTime($dateASS,$eDate1) If ($date1X=0 Or $date1X=1) And ($date2X=0 Or $date2X=-1) Then If $tOpCo[$x] = $targetOC Then ReDim $xx00[$vXXrow + 1][9] $xx00[$vXXrow][0] = $tLog[$x] $xx00[$vXXrow][1] = $tStat[$x] $xx00[$vXXrow][2] = $tStatus[$x] $xx00[$vXXrow][3] = $tType[$x] $xx00[$vXXrow][4] = $tComment[$x] $xx00[$vXXrow][5] = $tPendDate[$x] $xx00[$vXXrow][6] = $tAssigned[$x] $xx00[$vXXrow][7] = $tRecords[$x] $xx00[$vXXrow][8] = $tRecvd[$x] $vXXrow = $vXXrow + 1 EndIf EndIf Link to comment Share on other sites More sharing options...
b0ris Posted July 15, 2009 Author Share Posted July 15, 2009 Okay, after the second look, I found that I forgot to use DllStructGetPtr. Now it works, thanks for the help! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now