david7411 Posted November 11, 2005 Posted November 11, 2005 Hi Is it Datediff function only work with year after 1900 ? I modified the Datediff function AutoIt example to test and it not work with year 1899 as follow: #include <Date.au3> ; Calculated the number of seconds since EPOCH (1970/01/01 00:00:00) ;$iDateCalc = _DateDiff( 's',"1900/01/01 00:00:00",_NowCalc()) ; THIS WILL WORK FROM EXAMPLE $iDateCalc = _DateDiff( 's',"1899/01/01 00:00:00",_NowCalc()) ; BUT NOT THIS MsgBox( 4096, "", "Number of seconds since EPOCH: " & $iDateCalc & "error" & @Error ) ; Calculated the number of Hours this year $iDateCalc = _DateDiff( 'h',@YEAR & "/01/01 00:00:00",_NowCalc()) MsgBox( 4096, "", "Number of Hours this year: " & $iDateCalc )
Developers Jos Posted November 13, 2005 Developers Posted November 13, 2005 HiIs it Datediff function only work with year after 1900 ?Correct, _DateDiff() is using _DateIsValid() function to validate the input and this is one of the tests. 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.
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