On 4/1/06, Irfan J Sayed <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> How to get date and time in perl ? is there any function for that ?
>
> Regards
> Irfan Sayed

localtime() returns the current time in your timezone.  When called in
scalar context it returns a string representation of the date and
time.  When called in a list context it returns the individual
components of the date and time:

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

Due to its C based heritage you will need to make these modifications

$year += 1900;
$month++;

You might also want to look at the strftime function (in the POSIX module).

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to