Loading ...
Sorry, an error occurred while loading the content.

RE: "well the code is [PBML] still confused on dates

Expand Messages
  • Krishnakant Mane
    Charles K. Clarkson wrote: ... EVERY SCRIPT YOU WRITE SHOULD BEGIN WITH: use strict; use warnings; STOP TAKING SHORTCUTS! ...
    Message 1 of 19 , Apr 30, 2003
      "Charles K. Clarkson" <cclarkson@...> wrote:
      Krishnakant Mane wrote:

      : here is what I tried to do.


      use strict;
      use warnings;


      : use Time::Local;
      : use POSIX qw(strftime);
      : print strftime "%d/%b/%Y", localtime;
      : print " and \n";
      : print strftime "%d/%m/%Y", localtime;
      : print "\n";
      : print " and yesterday was \n";

      : ($DAY, $MONTH, $YEAR) = (localtime)[3,4,5];
      : $time = timelocal($DAY,$MONTH,$YEAR);

      According to the manual, which you obviously didn't
      bother to read, timelocal requires more than 3 arguments.
      We can only assume you meant to this:

      my @date = localtime();
      my $time = timelocal( @date );

      Which is the same thing as:

      my $time = time();

      : $TIME = $TIME - 60*60*24;

      If you had been using strict and warnings, you
      might have noticed that $TIME and $time are not
      the same variable. Perl is case-sensitive.

      What you probably want to do is:

      my $yesterday = time() - 60 * 60 * 24;

      Here is a solution for what it seems you are
      attempting. You'll have to modify it to work for
      your specific needs. If you want me to do it for
      you - hire me.


      use strict;
      use warnings;

      use Time::Local;
      use POSIX qw(strftime);

      my $date = get_epoch_date_from_database();

      my $yesterday = time() - 60 * 60 * 24;
      my $six_months = time() - 60 * 60 * 24 * 182;

      if ( $date > $yesterday ) {
      print "date is less than 1 day old\n\n";
      } elsif ( $date > $six_months ) {
      print "date is less than six months old\n\n";
      } else {
      print "date is more than six months old\n\n";


      Charles K. Clarkson
      Head Bottle Washer,
      Clarkson Energy Homes, Inc.
      Mobile Home Specialists
      254 968-8328

      Unsubscribing info is here: http://help.yahoo.com/help/us/groups/groups-32.html

      Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

      Hello Mr. Charlse.

      I got my solution.


      however you did not seam to understand one problem. Any ways it is not your mistake. I won't blaim you.

      my screen reader does not read the perl manual properly. so I can't rely on the manual.

      all I can do is just read the available books.

      I have tried many ways to read perlfunct manual but my screen reader can't navigate the manual properly. So it is obvious I will not bother to read the perl manual.

      and so there is no way I an going to understand things unless people like you help me through my experiences. as per the screen reader may be teddy might help.

      I am using jaws for windows and when I click the link of any perl function it still tries to read from the first line of the manual and I take a lot of time to go through the entire thing.

      any ways

      thank you for helping.

      Yahoo! Plus - For a better Internet experience

      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.