zackrspv Posted April 1, 2008 Share Posted April 1, 2008 (edited) Why is this not doing what I tell it to do? #include <Date.au3> $odate = "2008/02/31 09:14:18" $cDate = _NowCalc() $nDate = _DateDiff("d", $cDate, $odate) MsgBox(0, "test", " Old Date: "&$odate&@crlf&"Now Date: "&$cDate&@crlf&"---------------------------------------"&@crlf&"Difference in Days: "&$nDate)oÝ÷ ØÚ-zz&jÛ^¯Z¶*n¶)íêÞG¦íj)â§ÐZèZ´§uê쵩ÝÛ!¢é]²0¶÷ÞéÜy·Á秶¶u¬¬éèÁ©Ý¶j×¢¦ée{h×ë¢fW¢·l¶«y«uç%j·²Úâè®Ø^¦êé¢Ç¬¡ûaÈ^ު笵»Øî²Û!£.¥«4ÂÜ¢êìz+"Ê+ç-N¡zZ_W¢²)ÚqË«jײ+l,jëh×6#Include <Date.au3> _DateDaysInMonth($iYear, $iMonthNum) for the information on _DateDiff(). I'm using Autoit: --Production: 3.2.10.0 --Beta: 3.2.11.5 Edited April 1, 2008 by zackrspv -_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë. Link to comment Share on other sites More sharing options...
Siao Posted April 1, 2008 Share Posted April 1, 2008 Welcome to Earth.In our world date "2008/02/31" is invalid. "be smart, drink your wine" Link to comment Share on other sites More sharing options...
weaponx Posted April 1, 2008 Share Posted April 1, 2008 I was just going to say that. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 1, 2008 Developers Share Posted April 1, 2008 The @Error returned by the _DateDiff() functions also tells you that the EndDate is wrong. 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. Link to comment Share on other sites More sharing options...
zackrspv Posted April 1, 2008 Author Share Posted April 1, 2008 Welcome to Earth.In our world date "2008/02/31" is invalid.Wow, first off, thanks for the attitude. Though, to be honest, I'm not quite sure where it came from. I was polite in my comments on this forum, I worded my post correctly and in a friendly manner. But, I supose, that is your opinion, and I welcome you to it.However, as opinions count, I wouldn't quite rule out what I wrote above. While this is EARTH, the _NOWCALC() calc's it in the same method, as you can see below:So, If i'm not on earth, and Auto.IT functions are not on earth, then um, would you mind explaining to me, in your...attitude-rich...manner as to why it still will not work?Thanks! -_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë. Link to comment Share on other sites More sharing options...
zackrspv Posted April 1, 2008 Author Share Posted April 1, 2008 Wow, first off, thanks for the attitude. Though, to be honest, I'm not quite sure where it came from. I was polite in my comments on this forum, I worded my post correctly and in a friendly manner. But, I supose, that is your opinion, and I welcome you to it.However, as opinions count, I wouldn't quite rule out what I wrote above. While this is EARTH, the _NOWCALC() calc's it in the same method, as you can see below:So, If i'm not on earth, and Auto.IT functions are not on earth, then um, would you mind explaining to me, in your...attitude-rich...manner as to why it still will not work?Thanks!BTW, i should have also been more specific. I have tried 2008/03/05 and 2008/02/01 and 2008/01/05 as well, and none of them give anything other than 0; so while 2/31 is invalid, the others still don't work either -_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë. Link to comment Share on other sites More sharing options...
weaponx Posted April 1, 2008 Share Posted April 1, 2008 Its April Fools day, take everything with a grain of salt. There were only 28 days in February, your $odate is invalid. Link to comment Share on other sites More sharing options...
ofLight Posted April 1, 2008 Share Posted April 1, 2008 (edited) 28 days in Feb usually, except this yera there is 29. so 02/31 cant work. I tried 02/28 and it worked The code I used, Exact same as urs except 02/29. result was -33 days#include <Date.au3> $odate = "2008/02/29 09:14:18" $cDate = _NowCalc() $nDate = _DateDiff("d", $cDate, $odate) MsgBox(0, "test", " Old Date: "&$odate&@crlf&"Now Date: "&$cDate&@crlf&"---------------------------------------"&@crlf&"Difference in Days: "&$nDate) Edited April 1, 2008 by ofLight There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly Link to comment Share on other sites More sharing options...
zackrspv Posted April 1, 2008 Author Share Posted April 1, 2008 BTW, i should have also been more specific. I have tried 2008/03/05 and 2008/02/01 and 2008/01/05 as well, and none of them give anything other than 0; so while 2/31 is invalid, the others still don't work either So, as example: #include <Date.au3> $odate = "2008/02/01 09:14:18" $cDate = _NowCalc() $nDate = _DateDiff("d", $oDate, $cdate) MsgBox(0, "test", " Old Date: "&$odate&@crlf&"Now Date: "&$cDate&@crlf&"---------------------------------------"&@crlf&"Difference in Days: "&$nDate) still comes back as 0 -_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë. Link to comment Share on other sites More sharing options...
martin Posted April 1, 2008 Share Posted April 1, 2008 Wow, first off, thanks for the attitude. Though, to be honest, I'm not quite sure where it came from. I was polite in my comments on this forum, I worded my post correctly and in a friendly manner. But, I supose, that is your opinion, and I welcome you to it.However, as opinions count, I wouldn't quite rule out what I wrote above. While this is EARTH, the _NOWCALC() calc's it in the same method, as you can see below:So, If i'm not on earth, and Auto.IT functions are not on earth, then um, would you mind explaining to me, in your...attitude-rich...manner as to why it still will not work?Thanks!Hello, anyone there?It is working! The return is 0 if the function fails and @error is set according to the problem.As Jos said, the @error returned from _Datediff is 3 which means an invalid end date. So it would be better to use a valid date. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
weaponx Posted April 1, 2008 Share Posted April 1, 2008 (edited) Hello, anyone there?It is working! The return is 0 if the function fails and @error is set according to the problem.As Jos said, the @error returned from _Datediff is 3 which means an invalid end date. So it would be better to use a valid date.The end date is coming from _NowCalc(). The last piece of code posted returns 60 days for me... Edited April 1, 2008 by weaponx Link to comment Share on other sites More sharing options...
Developers Jos Posted April 1, 2008 Developers Share Posted April 1, 2008 So, as example: #include <Date.au3> $odate = "2008/02/01 09:14:18" $cDate = _NowCalc() $nDate = _DateDiff("d", $oDate, $cdate) MsgBox(0, "test", " Old Date: "&$odate&@crlf&"Now Date: "&$cDate&@crlf&"---------------------------------------"&@crlf&"Difference in Days: "&$nDate) still comes back as 0 Works nicely for me... what version of AutoIt3 are you running ? ps. don't get upset when somebody makes a joke about you making a mistake. We all make mistakes and there is no need to get upset about that, just smile. 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. Link to comment Share on other sites More sharing options...
weaponx Posted April 1, 2008 Share Posted April 1, 2008 Works nicely for me... what version of AutoIt3 are you running ?ps. don't get upset when somebody makes a joke about you making a mistake. We all make mistakes and there is no need to get upset about that, just smile.Check out the first post. Is it doing this in both production and beta? Link to comment Share on other sites More sharing options...
zackrspv Posted April 1, 2008 Author Share Posted April 1, 2008 Works nicely for me... what version of AutoIt3 are you running ?ps. don't get upset when somebody makes a joke about you making a mistake. We all make mistakes and there is no need to get upset about that, just smile.Hi,I'm using Autoit:--Production: 3.2.10.0--Beta: 3.2.11.5The only reason I become upset in these types of support forums, is because I'm honestly asking for help. I don't really expect the attitudes to come from such a good forum as this. But, as I said, he's entitled to his opinion, and I welcome it; it won't stop me from asking for help, or clarifying my position -_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë. Link to comment Share on other sites More sharing options...
zackrspv Posted April 1, 2008 Author Share Posted April 1, 2008 Hi,The only reason I become upset in these types of support forums, is because I'm honestly asking for help. I don't really expect the attitudes to come from such a good forum as this. But, as I said, he's entitled to his opinion, and I welcome it; it won't stop me from asking for help, or clarifying my position But, I identified the issue. My update script was putting a @CRLF at the end of the line to be read. Removed that and made the update script use _NOWCALC() instead of anything else and it updates w/o issue.Thanks -_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 1, 2008 Developers Share Posted April 1, 2008 Check out the first post. Is it doing this in both production and beta?yea, sometimes there is just too much to read. By the way: it is the Enddate that is wrong and is not the one set by _NowCalc(). 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. Link to comment Share on other sites More sharing options...
weaponx Posted April 1, 2008 Share Posted April 1, 2008 yea, sometimes there is just too much to read. By the way: it is the Enddate that is wrong and is not the one set by _NowCalc(). Well his first post had _NowCalc as the start date, then he reposted with _NowCalc as the end date:#500325Threw me off. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 1, 2008 Developers Share Posted April 1, 2008 Well his first post had _NowCalc as the start date, then he reposted with _NowCalc as the end date:#500325Threw me off.Yea "shit happens", I always claim I have these spells of senility kicking in. 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. Link to comment Share on other sites More sharing options...
zackrspv Posted April 1, 2008 Author Share Posted April 1, 2008 yea, sometimes there is just too much to read. By the way: it is the Enddate that is wrong and is not the one set by _NowCalc(). Si, my origonal update script wrote to the file with: FileWrite($file, @YEAR&"/"&@MON&"/"&@MDAY&" "&@hour&":"&@min&":"&@SEC&@crlf) Because I wasn't using _NOWCALC() in the origonal call it just wasn't workin haha, but it's ok now -_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 1, 2008 Developers Share Posted April 1, 2008 The only reason I become upset in these types of support forums, is because I'm honestly asking for help. I don't really expect the attitudes to come from such a good forum as this. But, as I said, he's entitled to his opinion, and I welcome it; it won't stop me from asking for help, or clarifying my position Just a closing remark as a reply to this one: I agree when only a joke is made in a way a bully would do, but in this case the joke pointed to the real problem in the posted script... there is a difference there! 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. 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