[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] guestbook.pl question (date)



> Hello, all!  I am using a nice guestbook made by Matthew M. Wright
> (http://www.worldwidemart.com/scripts/) it was originally a unix thing I
> think. After getting some help with the mac version of chmod it is running
> nicely but the following does not work:

I just made the following subroutine:
####
###################################################################
#return a current date stamp such as: "Tue, 09 Jan 96 5:06pm PST" #
###################################################################
sub dateStamp {
  ($sec,$min,$hour,$monthday,$month,$year,$weekday,$yearday,$isdaylight)=localtime;

  $ampm = "am";

  if ($hour > 12) {
    $hour -= 12;
    $ampm = "pm";
  }

  $theWeekday  = &convertWeekday($weekday);
  $theMonthday = &leadingZeros  ($monthday,10);
  $theMonth    = &convertMonth  ($month);
  $theMins     = &leadingZeros  ($min,10);

  "$theWeekday, $monthday $theMonth $year $hour:$theMins$ampm PST";
}

####

its maybe overkill, but it gives a nice date stamp.

kenn

> 
> # Get the Date for Entry
> $date = `$date_command +"%A, %B %d, %Y at %T (%Z)"`; chop($date);
> $shortdate = `$date_command +"%D %T %Z"`; chop($shortdate);
> 
> syntax check comes out ok, it just does not produce any output in the
> expected places like
> 
> print " $date<p>\n";
> 
> I guess there is probably a mac way to get the date of a guestbook entry!
> anyone know?  TIA - Pris
> 
> _______________________________________________________
> Thanks for your kind attention - I'm outta here!
> Pris Sears | sears@vt.edu | wk phone 540-231-4427 (USA)
> 
>