Hi,

Can you tell me exact command / syntax as i struggled lot but didn't 
succeed so that i can store date,time in some variable.

plz let me know.

Regards
Irfan Sayed

 



"Chas Owens" <[EMAIL PROTECTED]> 
04/10/2006 03:38 PM

To
Irfan J Sayed/India/[EMAIL PROTECTED]
cc
beginners@perl.org
Subject
Re: date and time in perl






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