try something like this:
my ($sec, $min, $hour, $day, $month, $year) = (localtime)[0,1,2,3,4,5];
$year = $year+1900;
$month = $month+1;
Perl has quite a few modules to fiddle around with dates a bit more cleaner
and much more sophisticated than this, but this may be all you need,
localtime() is a really funky function that returns different contexes
depending on what you give it. usually, to display a date quick and dirty,
you write something like this:
print scalar(localtime);
which does come in handy when making logging thingies.
--
justin simoni http://skazat.com
______________________________________________________________________
Steven Wright:
"Uh-Oh, I've lost a button-hole"
More:
http://quotes.prolix.nu
on 6/8/01 1:35 PM, Brian Hersey at [EMAIL PROTECTED] wrote:
> Hi All,
>
> OK, I'm REALLY new to Perl, and programming in general (I know, *sigh*) but
> I have what should be a pretty simple question.
>
> I'm trying to make a logon feature for a site that would compare 2 dates,
> one in a MySQL database of when a user has registered with a service and the
> present date when a user logs on. The dates are in the yyyy-mm-dd format,
> and I know how to use something like split(/-/, $datestring) to reformat
> them if necessary, but:
>
> 1. How do I get the present date from the server (it's a LINUX server)? All
> I know is something like:
>
> my $presesntdate = (localtime);
>
> but that gives me the date in the eg. (Fri Jun 8 15:08:25 2001) format,
> which doesn't give me a numerical month. I know this must be something quite
> simple.
>
> 2. How do I compare the date values, so that I can get a numerical value of
> days since the user first registered?
>
> Thanks a bunch,
> Brian
>
>