Re: How to see if a time is within two other times.
- From: James Taylor <spam-block-@xxxxxxxxxxxxxxx>
- Date: Wed, 29 Jun 2005 21:29:09 +0100
In article <1120074745.373483.169390@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Ninja67 <Ninja67@xxxxxxxxx> wrote:
>
> I need to modify a script in such a way that it checks the current time
> (according to the server) to determine if the current time falls within
> a particular time span such as midnight to 4:00 am.
You could just use the built in localtime function like this:
my $current_hour = (localtime)[2];
if ($current_hour < 4) {
# Time is after midnight and before 4am
} else {
# Time is after 4am and before midnight
}
Read up on localtime(). It behaves differently depending on context.
--
James Taylor, London, UK PGP key: 3FBE1BF9
To protect against spam, the address in the "From:" header is not valid.
In any case, you should reply to the group so that everyone can benefit.
If you must send me a private email, use james at oakseed demon co uk.
.
- Follow-Ups:
- Re: How to see if a time is within two other times.
- From: Ninja67
- Re: How to see if a time is within two other times.
- References:
- How to see if a time is within two other times.
- From: Ninja67
- How to see if a time is within two other times.
- Prev by Date: Re: How to see if a time is within two other times.
- Next by Date: Re: How to see if a time is within two other times.
- Previous by thread: Re: How to see if a time is within two other times.
- Next by thread: Re: How to see if a time is within two other times.
- Index(es):
Relevant Pages
|