Jump to content
Sign in to follow this  
bstewart

_DateDiff problem

Recommended Posts

bstewart

I am at a loss here. This appears as though it should work but I get 0 for the days difference. This is only partial code, the file is closed at the end of the script. The script reads the line containing the system formatted time. For some reason the thrid section (it is a direct copy from the help files) works. The object of thisis to inform the user that a process has not been run in more than 2 days and if approaching upper limit of 30 days.

FileOpen ("C:\scripts\autoreceive.log", 1)

$curDateString = FileReadLine("C:\scripts\autoreceive.log", 1)

MsgBox(1, "Current", $curDateString)

; This one does not work

$dateDifference = _DateDiff( 'd', $curDateString, _NowCalc())

MsgBox(1, "Overdue", $dateDifference)

; This one works

$dateDifference = _DateDiff( 's', "1970/01/01 00:00:00",_NowCalc())

MsgBox( 4096, "", "Number of seconds since EPOCH: " & $dateDifference )

Share this post


Link to post
Share on other sites
weaponx

$dateDifference = _DateDiff( 'd', $curDateString, _NowCalc())
Switch @ERROR
 Case 0
     MsgBox(0, "Overdue", $dateDifference)
 Case 1
     MsgBox(0, "", "Invalid $sType")
 Case 2
     MsgBox(0, "", "Invalid $sStartDate")
 Case 3
     MsgBox(0, "", "Invalid $sEndDate")
 EndSwitch

Edited by weaponx

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.