mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jun 2003
Posts: 19
S
Pikka bird
OP Offline
Pikka bird
S
Joined: Jun 2003
Posts: 19
I have a variable with past date format mm/dd/yyyy (06/24/2004) and a variable with past time format hh:mm:ss. I like to find out if the difference between current date/time and the date/time in VAR is 7 or greater, How do I do that ?

Please help

Thanks

sahmed01

Joined: Jun 2003
Posts: 19
S
Pikka bird
OP Offline
Pikka bird
S
Joined: Jun 2003
Posts: 19
The code is something like this

;Date (mm/dd/yyyy) format
%dt = $gettok(%info, 4, 32)
;time (hh:mm:ss) format
%tm = $gettok(%info, 5, 32)

Joined: Dec 2002
Posts: 788
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
If your looking to find the difference between 2 dates you simply do the follow:

$calc($cime - $ctime(DATEHERE))

Being.. currentdate - pastdate

..and this is in seconds, the code above..

Quote:

;Date (mm/dd/yyyy) format
%dt = $gettok(%info, 4, 32)
;time (hh:mm:ss) format
%tm = $gettok(%info, 5, 32)


Takes the 4th and 5th "word" (seperated by spaces) from %info and puts them into different variables.

Eamonn.

Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
if ($calc($ctime - $ctime($gettok(%info, 4-5, 32)) > 7) { echo -s it's more than 7... }

If it's 7 hours and not 7 seconds, use 25200 (= 7*60*60), you can think of appropriate values for 7 days etc smile

You can display the time between both by typing $duration($calc($ctime - $ctime($gettok(%info, 4-5, 32))


Link Copied to Clipboard