Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Determine weekends and compare two days

Reply
Thread Tools

Determine weekends and compare two days

 
 
Prak
Guest
Posts: n/a
 
      09-27-2004
I'm not much of a perl programmer so I was hoping someone could help
me. What I need to do is determine between 2 dates whether there is a
weekend between them inclusive.

eg Between 1 Oct 2004 and 4 Oct 2004 there is a Sat. and a Sunday but
between 5 Oct 2004 and 8 Oct 2004, there is no Sat or Sunday.

Thanks in advance
Prak
 
Reply With Quote
 
 
 
 
Julia De Silva
Guest
Posts: n/a
 
      09-27-2004
> I'm not much of a perl programmer so I was hoping someone could help
> me. What I need to do is determine between 2 dates whether there is a
> weekend between them inclusive.
>
> eg Between 1 Oct 2004 and 4 Oct 2004 there is a Sat. and a Sunday but
> between 5 Oct 2004 and 8 Oct 2004, there is no Sat or Sunday.
>
> Thanks in advance
> Prak


You really ought to try working this one out on your own! That way you'll
understand and improve. Here's a pointer.

use Time::localtime;
my $today = time;
my $day_of_week = localtime($today)->wday;
my @days_of_week = qw(Sun Mon Tues Wed Thur Fri Sat);
print"Today is $days_of_week[$day_of_week]\n";



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Global Python Sprint Weekends: May 10th-11th and June 21st-22nd. Trent Nelson Python 0 04-16-2008 05:51 PM
How to compare two SOAP Envelope or two Document or two XML files GenxLogic Java 3 12-06-2006 08:41 PM
list of days between two days kirke Javascript 7 10-20-2006 07:17 AM
adding days to a date, bypass weekends =?Utf-8?B?ZGhucml2ZXJzaWRl?= ASP .Net 4 12-09-2004 03:34 PM
Is the sport of Eddierox baiting only played at weekends or can it be played during the week? Typh0n MCSE 67 04-07-2004 12:40 AM



Advertisments