Jump to content

Recommended Posts

Posted

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)

  • Developers
Posted

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.

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.
  :)

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
×
×
  • Create New...