Re: How to see if a time is within two other times.
- From: "Ninja67" <Ninja67@xxxxxxxxx>
- Date: 29 Jun 2005 13:32:32 -0700
James Taylor wrote:
> 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.
Thank you. I derived at that solution independently, but that is
indeed what I ended up doing. I was over-complicating it at first.
Thanks again.
.
- References:
- 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.
- From: James Taylor
- 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
|
|