mIRC Home    About    Download    Register    News    Help

Print Thread
#118102 22/04/05 11:05 AM
Joined: Sep 2004
Posts: 73
S
SteeleR Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Sep 2004
Posts: 73
i have to compare two times ... how do i do that ...
tried with $time(%t1) < $time(%t2) but apparently it doen't works.
10x in advance smile


HanPeg HanPeg u BuHaru HanPeg nPu noPa}|{eHue kParoM u nAk HanPeg
#118103 22/04/05 11:19 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Works for me, how are you setting the variables?

I typed..

Code:
 //if ($time(12:13:14) &lt;= $time($time)) echo -a $ifmatch is less than $v2

#118104 22/04/05 11:33 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
$time doesn't take a parameter o.O

$time($time) just returns $time so you can omit the first one.

$time(12:45:30) or whatever you in put just returns the same thing, it's entirely obsolete.

$time(lol) returns lol.

lol

I can't help with the requester as I don't really understand how a time can be "smaller" than another time. He also didn't specify if this is AM/PM format or 24 hour.

Is 1 am smaller than 10 pm? Well of course 1 is smaller than 10, though 1 am comes after 10 pm. Or maybe 1 am comes before 10 pm...it's all in how you look at it. In the 24 hour system the example still counts: is 01:00 smaller than 22:00? 22 is definitely bigger than 1, though 01:00 is further in time than 22:00. Or is it?

If the time numbers are always zero padded, like 01:55 instead of 1:55 then you can just use a regular if statement: //if 04:00 < 04:05 { do things }. It needs zero padding, because otherwise //if 1:55 < 11:55 { echo yes } would not echo. //if 01:55 < 11:55 { echo yes } would.

You can also use $duration on both and compare those (as $duration without second parameter returns number of seconds), you can do something with $ctime etc., there are a few ways.


Gone.
#118105 22/04/05 11:53 AM
Joined: Sep 2004
Posts: 73
S
SteeleR Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Sep 2004
Posts: 73
gonna try with $duration ... and ofcourse it's for 24 hours format smile


HanPeg HanPeg u BuHaru HanPeg nPu noPa}|{eHue kParoM u nAk HanPeg
#118106 22/04/05 01:11 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You should probably attempt it using $ctime. Set your variable using $ctime and compare it to current $ctime, then convert it to a normal time format using $duration.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard