Re: getting $date



Graham Gough <graham@xxxxxxxxxxxx> wrote in
news:ttlu0kjy6ja.fsf@xxxxxxxxxxxxxxxxxxx:

[ Please quote some context when you reply.]

> #!/usr/bin/perl
>
> use strict;

use warnings;

missing.

> my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
> localtime();

my ($mday, $mon, $year) = (localtime)[3 .. 5];

> $year += 1900;
> $mon++;
>
> my $date = "$mday/$mon/$year";
>
> print $date, "\n";

printf "%2.2d/%2.2d/%4.4d\n", $mday, $mon + 1, $year + 1900;

Sinan

--
A. Sinan Unur <1usa@xxxxxxxxxxxxxxxxxxx>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
.



Relevant Pages

  • Re: Win32::OLE::GetObj question
    ... > You can access MS VBA editor from Tools -> Macro. ... > use View -> Object Browser to get information about objects, methods, ... > A. Sinan Unur ... use warnings; ...
    (comp.lang.perl.misc)
  • Re: DocumentHTML ?
    ... And when, finally, I saw that he'd added "use warnings" to my original code ... I thought Mr Unur had "middle-posted" and left, ... Sinan Unur"> wrote ... ... to set your security settings to a low and possibly unsafe level. ...
    (comp.lang.perl.misc)
  • Re: problem about the perl code. thanks for any comments
    ... Thanks for Sinan 's help. ... Sinan Unur wrote: ... > missing. ... > Please read the posting guidelines for this group to lern how you can ...
    (comp.lang.perl.misc)
  • Re: source a config file
    ... > with warnings and strict. ... > I don't want warnings about a variable being used only once. ... > I don't want to put too much cruft in the config file. ... Sinan. ...
    (comp.lang.perl.misc)
  • Re: HTML Parser
    ... "Asoup" wrote in ... use warnings; ... use strict; ... Sinan. ...
    (comp.lang.perl.misc)