Champak Posted April 10, 2008 Share Posted April 10, 2008 Can someone tell me why the following isn't working? If _DateDiff( 'd',$Full_List[$Position][5],_NowCalc()) <= 2 Then $PriceDate = "Price is recent and most likely still in effect." GUICtrlSetColor($Label_Date,0x00EC00) ElseIf _DateDiff( 'd',$Full_List[$Position][5],_NowCalc()) >= 3 And _DateDiff( 'd',$Full_List[$Position][5],_NowCalc()) <= 4 Then $PriceDate = "Price is 3 to 4 days old." GUICtrlSetColor($Label_Date,0xFF860D) ElseIf _DateDiff( 'd',$Full_List[$Position][5],_NowCalc()) > 5 Then $PriceDate = "Price is older than 5 days." GUICtrlSetColor($Label_Date,0xFF0000) EndIf It only seems to see the first "IF" function no matter what the date difference is. The difference is always "0". If I put the consolewrite inside the first "IF", I can see that the date is hitting ranges where they should actually be going into the other "elseif" functions, but the calculations difference always come back as "0". What am I not seeing? Link to comment Share on other sites More sharing options...
spudw2k Posted April 10, 2008 Share Posted April 10, 2008 (edited) The only thing I can think of is maybe the format of your timestamp is incorrect. What date for example is stored in your array? msgbox(0,"",$Full_List[$Position][5]) I think it has to look like this. "YYYY/MM/DD hh:mm:ss" Edited April 10, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Monamo Posted April 10, 2008 Share Posted April 10, 2008 Can someone tell me why the following isn't working? If _DateDiff( 'd',$Full_List[$Position][5],_NowCalc()) <= 2 Then $PriceDate = "Price is recent and most likely still in effect." GUICtrlSetColor($Label_Date,0x00EC00) ElseIf _DateDiff( 'd',$Full_List[$Position][5],_NowCalc()) >= 3 And _DateDiff( 'd',$Full_List[$Position][5],_NowCalc()) <= 4 Then $PriceDate = "Price is 3 to 4 days old." GUICtrlSetColor($Label_Date,0xFF860D) ElseIf _DateDiff( 'd',$Full_List[$Position][5],_NowCalc()) > 5 Then $PriceDate = "Price is older than 5 days." GUICtrlSetColor($Label_Date,0xFF0000) EndIf It only seems to see the first "IF" function no matter what the date difference is. The difference is always "0". If I put the consolewrite inside the first "IF", I can see that the date is hitting ranges where they should actually be going into the other "elseif" functions, but the calculations difference always come back as "0". What am I not seeing?Have you done a verification of the data being read from the array? If so, can you post a sample of the output to help determine if it's perhaps a data structure validation issue? Ex: ConsoleWrite($Full_List[$Position][5]) - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup] Link to comment Share on other sites More sharing options...
Champak Posted April 10, 2008 Author Share Posted April 10, 2008 (edited) It was the format, I forgot I changed the original format before I initially put it in the array. Thanks for the heads up. Edited April 10, 2008 by Champak 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