[Israel.pm] time of pc

Ephraim Dan E.Dan at F5.com
Thu Jun 22 01:34:25 PDT 2006


If you're only talking about formatting a date, Date::Calc is way overboard.

I recommend using POSIX::strftime to format localtime() return values, instead of writing the code below.

perl -MPOSIX -le'print POSIX::strftime("%H:%M:%S %Y-%m-%d", localtime())'

Or perhaps you only need "scalar localtime" if you just want a basic human-readable string?

-edan

> -----Original Message-----
> From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On Behalf
> Of Mike Freedman
> Sent: Thursday, June 22, 2006 10:25
> To: 'Perl in Israel'
> Subject: Re: [Israel.pm] time of pc
> 
> Yeah - date::calc is one of my faves, I use it often!
> 
> -----Original Message-----
> From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On Behalf
> Of rami doqa
> Sent: 22 June 2006 08:20
> To: Perl in Israel
> Subject: Re: [Israel.pm] time of pc
> 
> hello, to do that u need to write the following code:
> 
> my @time = localtime(time());
> 
> my $second = $time[0];
> my $minute = $time[1];
> my $hour = $time[2];
> 
> my $day = $time[3];
> my $month = $time[4]+1;
> my $year = $time[5]+1900;
> 
> after that u can join the formate u want to view
> 
> or use date::calc on CPAN
> 
> --- "Ernst, Yehuda" <yernst at nds.com> wrote:
> 
> > Hello!
> >
> > How do i show the time (clock) of my pc in perl?
> >
> > i tried localtime but i could not parse it.
> >
> > Thanks
> >
> > Yehuda Ernst                        יהודה
> > ארנסט
> > NDS Technologies Israel Ltd. mailto:yernst at nds.com>
> > Jerusalem          Tel:  +972 (2) 589-4427
> > PO Box 23012    Fax: +972 (2) 589-4825
> > Israel.    91235    Cell  +972 54 5664427
> >
> >
> **************************************************************************
> **
> *******
> > This email message and any attachments thereto are intended only for
> > use by the addressee(s) named above, and may contain legally
> > privileged and/or confidential information. If the reader of this
> > message is not the intended recipient, or the employee or agent
> > responsible to deliver it to the intended recipient, you are hereby
> > notified that any dissemination, distribution or copying of this
> > communication is strictly prohibited. If you have received this
> > communication in error, please immediately notify the
> > postmaster at nds.com and destroy the original message.
> >
> **************************************************************************
> **
> *******
> >
> > _______________________________________________
> > Perl mailing list
> > Perl at perl.org.il
> > http://perl.org.il/mailman/listinfo/perl
> >
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl
> 
> 
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl




More information about the Perl mailing list