enlait Posted August 17, 2011 Posted August 17, 2011 Good day. I'm new to autoit and I ran into a problem here.. I need to check datetime value against a specific time in a current day. So I tried to do it like this: $reset = _DateAdd("h", $resetHour, _NowCalcDate()) If _DateDiff("s", $reset, $time) > 0 Then ... However, _NowCalcDate returns just a date so it doesn't work. At least this piece of code makes me think so: #include <Date.au3> $reset = _DateAdd("h", 2, _NowCalcDate()) MsgBox(0,"",$reset) Is there any way to convert date into full datetime? Or to set particular absolute values (hour, minute etc) instead of just adding/substracting? Sorry if this is explained in a help or was already answered, I wasn't able to find an answer myself. Now that I think about it, I can substract what I need from the other variable ($time in my case) but that's just plain dirty.
Juvigy Posted August 17, 2011 Posted August 17, 2011 What you need it NowCalc(): #include <Date.au3> ; Calculated the number of seconds since EPOCH (1970/01/01 00:00:00) $iDateCalc = _DateDiff( 's',"1970/01/01 00:00:00",_NowCalc()) MsgBox( 4096, "", "Number of seconds since EPOCH: " & $iDateCalc ) ; 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 )
enlait Posted August 17, 2011 Author Posted August 17, 2011 (edited) Thank you. I missed the point that a date is actually a string. Edited August 17, 2011 by enlait
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