Re: getting $date



spam wrote:
Graham Gough <graham@xxxxxxxxxxxx> wrote:


perldoc -f localtime


That probably is what I'm looking for, but the perldoc page isn't (to
me, a newbie) very clear ..


Converts a time as returned by the time function to a 9-element
               list with the time analyzed for the local time zone.
Typically
               used as follows:

                   #  0    1    2     3     4    5     6     7     8
                   ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
= localtime(time);

OK, so in my code, I put ...

my $date = localtime ($day, $mday, $year) ;

No surprises: it doesn't work.

All other combinations (locatime inside brackets, outside brackets, with
curly brackets, with $ in front, after, in the middle ..) don't work.

You need to master elemntary perl first, before trying such am ambitous project B-{)


my @tvec = localtime();
my $date = sprintf("%02d%02d%02d", $tvec[3], $tvec[4]+1, $tvec[5] % 100);

Josef
--
Josef Möllers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett

.



Relevant Pages

  • Re: getting $date
    ... That probably is what I'm looking for, but the perldoc page isn't (to ... a newbie) very clear .. ... Converts a time as returned by the time function to a 9-element ... All other combinations (locatime inside brackets, outside brackets, with ...
    (comp.lang.perl.misc)
  • Re: Select
    ... I am a newbie. ... Becuase the actual query I did was ... After adding the brackets as following, ...
    (microsoft.public.sqlserver.server)
  • Re: array question
    ... can you explain the brackets? ... Wich is ... perldoc perlretut # search for /whitespace/i ...
    (perl.beginners)
  • Re: Limits in displaymath not appearing beneath symbol.
    ... I'm a bit of a newbie and I always forget to use the proper form ... for brackets... ... Prev by Date: ...
    (comp.text.tex)