in reply to How can I add 1 hour to the current time

print scalar localtime time + 3600;

But maybe you want something else, in which case you should show us what you've got or tell us more about what you want.

True laziness is hard work

Replies are listed 'Best First'.
Re^2: How can I add 1 hour to the current time
by sureshrps (Novice) on Aug 20, 2011 at 08:33 UTC
    Thanks for the reply. I want London time. Hence i used the following code to find. $now = gmtime() ; print $now; the print is "Sat Aug 20 08:26:46 2011". This is GMT time. London Current time zone is UTC/GMT +1 hour. Hence I need to add 1 hour. Regards Suresh

      Wouldn't it be easier to just get the time in London?

      use DateTime; my $dt = DateTime->now( time_zone => 'Europe/London' ); say $dt->strftime('%Y-%m-%d %H:%M:%S');
        The DateTime method is not working. ie, In my system PPM, there is no package in "DateTime" and installed remaining packages like DateTime::TimeZone.. i have downloaded the DateTime module from CPAN. But in this package there is no MakeFile.pl. if i run the DateTime code, wil coming the error like "Can't locate DateTime.pm". Hence only i have go to alternative method for finding the current local time in London. Please provide the solution without using DateTime method. Suresh