day of week

Discussion in 'Perl' started by andy, Jan 27, 2007.

  1. andy

    andy Guest

    Greetings

    Could anyone kindly help me figure out how to add the day of the week to
    David Spelts' Traffic Log "Hits By Day"?

    I tried the following and could not implement any properly. I am a perl
    newbie and would appreciate any help. I imagine this is simple for a perl
    guru:

    #$dayofweek = Date_DayOfWeek($month,$day,$year);
    #my $date = ParseDateString("15 mar 1999");
    $date = substr($key,0,6);
    print UnixDate($date, "%a");
    #$dayofweek = UnixDate($date, "%A");

    #my $dt = DateTime->new(year => $year, month => $month, day => $day);
    #my $dow = $dt->day_of_week();

    #use Date::Calc; # you need this to calculate your date
    #my $a = Date::Calc::Date_to_Text(2005, 12, 15);

    I am using a Linux server with perl ver 5.8.7

    all files required to run the script can be found here:
    http://www.spelts.com/trafficlog/
    andy, Jan 27, 2007
    #1
    1. Advertising

  2. andy

    Jim Gibson Guest

    In article <>, andy wrote:

    > Greetings
    >
    > Could anyone kindly help me figure out how to add the day of the week to
    > David Spelts' Traffic Log "Hits By Day"?
    >
    > I tried the following and could not implement any properly. I am a perl
    > newbie and would appreciate any help. I imagine this is simple for a perl
    > guru:
    >
    > #$dayofweek = Date_DayOfWeek($month,$day,$year);
    > #my $date = ParseDateString("15 mar 1999");


    What is the purpose of posting commented-out code?

    > $date = substr($key,0,6);


    What is in $key?

    > print UnixDate($date, "%a");


    What module implements UnixDate?

    > #$dayofweek = UnixDate($date, "%A");
    >
    > #my $dt = DateTime->new(year => $year, month => $month, day => $day);


    What module implements DateTime?

    > #my $dow = $dt->day_of_week();


    What module implements day_of_week?

    >
    > #use Date::Calc; # you need this to calculate your date
    > #my $a = Date::Calc::Date_to_Text(2005, 12, 15);


    Finally, a clue as to which module you are attempting to use!

    > I am using a Linux server with perl ver 5.8.7
    >
    > all files required to run the script can be found here:
    > http://www.spelts.com/trafficlog/


    So you expect us to go to this website, download the program, install
    it on our webserver, and test it? You must not want help very badly.

    Maybe this will help:

    #!/usr/local/bin/perl
    use strict;
    use warnings;
    use Date::Calc qw(Day_of_Week);
    my @days = qw( Sun Mon Tue Wed Thu Fri Sat );
    my $dow =Day_of_Week(2005, 12, 15 );
    print "Dec 15, 2005 is a $days[$dow]\n";


    FYI: this newsgroup is defunct. Try comp.lang.perl.misc in the future
    (but if you do, please read and comply with the guidelines for that
    group).

    Good luck.

    Posted Via Usenet.com Premium Usenet Newsgroup Services
    ----------------------------------------------------------
    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
    ----------------------------------------------------------
    http://www.usenet.com
    Jim Gibson, Jan 29, 2007
    #2
    1. Advertising

  3. andy

    andy Guest

    LOL

    "Jim Gibson" <> wrote in message
    news:290120071035335574%...
    > In article <>, andy wrote:
    >
    >> Greetings
    >>
    >> Could anyone kindly help me figure out how to add the day of the week to
    >> David Spelts' Traffic Log "Hits By Day"?
    >>
    >> I tried the following and could not implement any properly. I am a perl
    >> newbie and would appreciate any help. I imagine this is simple for a perl
    >> guru:
    >>
    >> #$dayofweek = Date_DayOfWeek($month,$day,$year);
    >> #my $date = ParseDateString("15 mar 1999");

    >
    > What is the purpose of posting commented-out code?
    >
    >> $date = substr($key,0,6);

    >
    > What is in $key?
    >
    >> print UnixDate($date, "%a");

    >
    > What module implements UnixDate?
    >
    >> #$dayofweek = UnixDate($date, "%A");
    >>
    >> #my $dt = DateTime->new(year => $year, month => $month, day => $day);

    >
    > What module implements DateTime?
    >
    >> #my $dow = $dt->day_of_week();

    >
    > What module implements day_of_week?
    >
    >>
    >> #use Date::Calc; # you need this to calculate your date
    >> #my $a = Date::Calc::Date_to_Text(2005, 12, 15);

    >
    > Finally, a clue as to which module you are attempting to use!
    >
    >> I am using a Linux server with perl ver 5.8.7
    >>
    >> all files required to run the script can be found here:
    >> http://www.spelts.com/trafficlog/

    >
    > So you expect us to go to this website, download the program, install
    > it on our webserver, and test it? You must not want help very badly.
    >
    > Maybe this will help:
    >
    > #!/usr/local/bin/perl
    > use strict;
    > use warnings;
    > use Date::Calc qw(Day_of_Week);
    > my @days = qw( Sun Mon Tue Wed Thu Fri Sat );
    > my $dow =Day_of_Week(2005, 12, 15 );
    > print "Dec 15, 2005 is a $days[$dow]\n";
    >
    >
    > FYI: this newsgroup is defunct. Try comp.lang.perl.misc in the future
    > (but if you do, please read and comply with the guidelines for that
    > group).
    >
    > Good luck.
    >
    > Posted Via Usenet.com Premium Usenet Newsgroup Services
    > ----------------------------------------------------------
    > ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
    > ----------------------------------------------------------
    > http://www.usenet.com
    andy, Jan 30, 2007
    #3
    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. Guest
    Replies:
    3
    Views:
    1,827
    Alexandre
    Dec 22, 2003
  2. Andy
    Replies:
    1
    Views:
    681
  3. Guest
    Replies:
    3
    Views:
    516
    Alexandre
    Dec 22, 2003
  4. Guest
    Replies:
    3
    Views:
    1,072
    Alexandre
    Dec 22, 2003
  5. SimonC
    Replies:
    13
    Views:
    326
    Dr John Stockton
    Jan 4, 2005
Loading...

Share This Page