Nichole

congratulations on solving your problem.  When I first started using perl, I
used to use a rather ugly construct to get the dates and times in the format
I'd like them.

Later on I noticed the sprintf function.  You can use this to format your
dates and times without cycling through all the elements returned by the
localtime function.  Anyway I am pasting in a bit from one of my scripts
that does just this:

($sec,$min,$hour, $day,$mon,$year) = (localtime(time))[0, 1, 2, 3, 4, 5];

$date_time = sprintf("%04u%02u%02u %02u:%02u:%02u",
                      $year + 1900, $mon + 1,  $day, $hour, $min, $sec);

The %04u mean an unsigned integer; you can find out more if you look at the
perlfunc documentation, assuming that this is what you wanted to do, if not
please just ignore this post.

Anyway happy perling.

Regards

Ahmer



-----Ursprungliche Nachricht-----
Von: Nichole Bialczyk [mailto:[EMAIL PROTECTED]]
Gesendet: 31 May 2001 19:21
An: [EMAIL PROTECTED]
Betreff: thankyouthankyouthankyou!!!!!


thank you to everyone who gave me suggestions! i tried to use 'use vars'
but then i couldn't figure out how to assign $timelog to it. the other
method worked much better! i needed time log so that i could cycle throuh
all of the variables to add a 0 to the front of the number if it was <10.
this way i don't have to write for loops for each variable to check, but
a single foreach loop.

thank you! now if i could just figure out how to print to a log, I'd be
set!

time for more research....

thanks again, nichole


Reply via email to