Determine weekends and compare two days

Discussion in 'Perl Misc' started by Prak, Sep 27, 2004.

  1. Prak

    Prak Guest

    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
     
    Prak, Sep 27, 2004
    #1
    1. Advertising

  2. > 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";
     
    Julia De Silva, Sep 27, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?ZGhucml2ZXJzaWRl?=

    adding days to a date, bypass weekends

    =?Utf-8?B?ZGhucml2ZXJzaWRl?=, Dec 9, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    2,794
    John Saunders
    Dec 9, 2004
  2. GenxLogic
    Replies:
    3
    Views:
    1,370
    andrewmcdonagh
    Dec 6, 2006
  3. Trent Nelson
    Replies:
    0
    Views:
    299
    Trent Nelson
    Apr 16, 2008
  4. calendar control - weekends

    , Sep 13, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    110
  5. kirke

    list of days between two days

    kirke, Oct 19, 2006, in forum: Javascript
    Replies:
    7
    Views:
    151
    Julian Turner
    Oct 20, 2006
Loading...

Share This Page