Can you show us what you've got so far?
perldoc -f localtime is the traditional starting
place for date & time. Pay particular attention to the
"odd" values returned for the month & year.
As you probably already know, the slightly tricky part is getting
the leading zeros. You can do something basic, like:
($day < 10) && ($day = "0$day");
($month < 10) && ($month = "0$month");
Or, you could use a standard function which allows you
to specify padding values for fields (sprintf),
An even better choice is strftime, which was
especially written to handle date/time values.
This site is a treasure trove of articles written by people
who have asked similar questions in the past. The best way
to find this material is to use Super Search. I just did,
and found several articles that will help you with this
question.
| [reply] [d/l] [select] |
use Date::Format;
print time2str( "%D", time );
Check out this node which answers nearly the exact same question, with lots of discussion.
___ -DA | [reply] [d/l] [select] |
Your question is a little unclear, it's impossible to be
sure what date format you mean - is that MM/DD/YY or the
far more logical DD/MM/YY.
And didn't the last couple of years teach you anything
about the dangers of two digit dates?
ISO has a standard format for dates and it's pretty good
as it's a) sortable and b) unambiguous. Why not format
your dates like this: YYYY-MM-DD.
Oh, and Perl comes with a built-in function to produce
dates in any format, lookup the docs for
POSIX::strftime.
--
<http://www.dave.org.uk>
Perl Training in the UK <http://www.iterative-software.com>
| [reply] |
why don't you SEARCH before asking such a simple question!?!?
If you want somebody to do your work, i believe that's the wrong place to ask!
Shame on you!
#!/jpsama/bin/perl -w
$tks = `mount`;
$jpsama = $! if $!;
print $jpsama;
| [reply] |
Well, I believe i was a litle rude, and for that i apologize.
But, i still think that you should SHOW us that you tried something... eg. post the CODE you're doing.. ok?
I will be really glad to help you with your scripts...
Regards
#!/usr/bin/perl -w
$mount = `mount`; $error = $! if $!;
print $mount; print $error;
| [reply] [d/l] |