mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2003
Posts: 86
N
NRJ Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Mar 2003
Posts: 86
I want to create a script, that say me, if the Time in $1 is in history, today or in future.

e.g.: /timeask 10.11.2003
[ echo: 10.11.2003 is in the future! ]

or:

/timeask 08.11.2003
[ echo: 08.11.2003 is in the history! ]

How can I do it?

Mathias

Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Code:
alias timeask {
  echo -a $1 is $iif($1 == $date,today,$iif($ctime($1) > $ctime,in the future,in the past))
}

/timeask 10/11/2003
/timeask 09/11/2003
/timeask 08/11/2003

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Code:
alias timeask {
  var %a = $ctime($1)
  if !%a { echo -a Invalid parameters: $1 }
  elseif $asctime(%a,ddmmyyyy) == $asctime(ddmmyyyy) { echo -a $1 is today }
  elseif %a < $ctime { echo -a $1 is in history }
  else echo -a $1 is in the future
}
Edit: oops, as usual I was too long in preview mode. Collective's method is the same, I'd only add that $ctime() accepts formats like
9.11.2003
09.11.2003
9.11.03
09.11.03
9/11/2003
9/11/03
09/11/03
My method allows all these formats since it doesn't compare the raw input (which can vary) with $date (which is a fixed format), but transforms it in $ctime value and then back to $asctime.

Last edited by qwerty; 09/11/03 10:30 AM.

/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Mar 2003
Posts: 86
N
NRJ Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Mar 2003
Posts: 86
Thx laugh


Link Copied to Clipboard