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

Re: [MacPerl] WWWBoard and MacPerl



Vicki Brown <vlb@cfcl.com> wrote:

>I suggest you translate the code to "native" perl.  Try:
>
>  $date_command = localtime();
>
>Note that the only difference will be that the localtime function does not
>output the time zone field (as date would). Oh, and the output of `date`
>comes with a newline (needs to be chomped); localtime doesn't.
>
>% cat time.pl
>#!/usr/local/bin/perl
>
>$unix_date = `/bin/date`;
>$perl_date = localtime();
>
>print "$unix_date\n";
>print "$perl_date\n";
>
>% time.pl
>Tue Aug 25 13:58:38 PDT 1998
>
>Tue Aug 25 13:58:38 1998

or you could use gmtime, which gives you the Grenwich Mean Time or UT:

  $date_command = gmtime();

or modifying Vicki example:

#!/usr/local/bin/perl

$gm_date = gmtime();
$local_date = localtime();

print "$gm_date GMT\n";
print "$local_date PDT\n";

which outputs:

Wed Aug 26 00:34:28 1998 GMT
Tue Aug 25 17:34:28 1998 PDT

JMTCW.

--Brian



# Fungal Parataxonomy                   Mycology Information (Mycoinfo)
# Webmaster, Staff Writer      **The World's First Mycology E-Journal**   
# <mailto:webmaster@mycoinfo.com>            <http://www.mycoinfo.com/> 
# "A couple of guys trying to do something great..."



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch