Blue_Drache Posted January 31, 2005 Posted January 31, 2005 (edited) Ok, I'm having some trouble here. Raw code follows: While 1 If $q = (($extents[0])-1) Or $extents[$q] = "" Then $bailout = 1 ExitLoop EndIf $cxd[$q] = StringTrimRight(StringRight($extents[$q], 7), 1) $eff[$q] = StringLeft(StringRight($extents[$q], 13), 6) ;;;; NEW SECTION TO CALCULATE DATE CORRECTLY If StringRight($eff[$q],2) > 90 then $effdate = "19" & StringRight($eff[$q],2) & "/" & StringLeft($eff[$q],2) & "/" & StringRight(StringLeft($eff[$q],4),2) Else $effdate = "20" & StringRight($eff[$q],2) & "/" & StringLeft($eff[$q],2) & "/" & StringRight(StringLeft($eff[$q],4),2) EndIf $fromcalc = StringStripWS($from[3] & "/" & $from[1] & "/" & $from[2],8) $diff = _DateDiff("d",$fromcalc,$effdate) MsgBox(262144,'debug line ~233a' , '$fromcalc:' & @lf & $fromcalc & @lf &'$effdate:' & @lf & $effdate & @lf &'$diff:' & @lf & $diff&@lf &@error);### Debug MSGBOX MsgBox(262144,'debug line ~233b' , '$eff:' & @lf & $eff[$q]);### Debug MSGBOX ;;;; END OF NEW SECTION If $eff[$q] < $from[1] & $from[2] & StringRight($from[3], 2) And $cxd[$q] = "000000" And StringRight($extents[$q], 1) = "H" Then Dim $tabs = $q - 2 ExitLoop EndIf $q = $q + 1 WEnd $eff[$q] will wind up being a 6 digit date in MMDDYY format. I manipulate the screen scraped data into the proper format for _DateDiff, but the _DateDiff function is always returning a 0 and says I have a problem with the From Date (@error = 2). For example: My debug box will show that my eff[$q] formula works out to 2004/01/14 and my $from is 2005/01/25. AFAIK, this is the correct format for datediff ("YYYY/MM/DD"). I've tried stripping any whitespace from it just in case, but I still get an @error = 2. What am I missing? Edited January 31, 2005 by Blue_Drache Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
Developers Jos Posted January 31, 2005 Developers Posted January 31, 2005 well datediff works with the provided dates: #include <date.au3> $effdate = "2004/01/14" $fromcalc = "2005/01/25" $diff = _DateDiff("d", $fromcalc, $effdate) MsgBox(262144, 'debug line ~4', '$diff:' & @LF & $diff);### Debug MSGBOX So there must be something wrong with the input date ($fromcalc). Maybe check for special characters like @CR or @LF or check its lenght to see if its 10 . SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Blue_Drache Posted February 1, 2005 Author Posted February 1, 2005 well datediff works with the provided dates:#include <date.au3> $effdate = "2004/01/14" $fromcalc = "2005/01/25" $diff = _DateDiff("d", $fromcalc, $effdate) MsgBox(262144, 'debug line ~4', '$diff:' & @LF & $diff);### Debug MSGBOXSo there must be something wrong with the input date ($fromcalc). Maybe check for special characters like @CR or @LF or check its lenght to see if its 10 .<{POST_SNAPBACK}>Good idea, I'll force the inital data scrape to only return the 6 characters I requre to manipulate the date and see what shakes loose. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
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