Sign in to follow this  
Followers 0
david7411

Datediff

2 posts in this topic

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 )

B)

Share this post


Link to post
Share on other sites



Hi

Is 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.


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0