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

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
  • Comment on Re^2: How can I add 1 hour to the current time

Replies are listed 'Best First'.
Re^3: How can I add 1 hour to the current time
by ikegami (Patriarch) on Aug 20, 2011 at 08:51 UTC

    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

        I must have misread the question. It didn't sound anything like asking for help installing DateTime.

        In my system PPM, there is no package in "DateTime"

        ppm? So you're using ActivePerl? ActiveState's repo carries DateTime for my version. What's the output of perl -v?

        But in this package there is no MakeFile.pl.

        You mean Makefile.PL? It has Build.PL. You also seem to have missed the fact that it has installation instructions in INSTALL.

        Hence only i have go to alternative method for finding the current local time in London.

        Thank god you don't own a car. Replacing the entire car every time the tires get worn down would get expensive.