Hours in timestamp

0

Talk to the people, everything beauty?

Is it possible for me to know how much is two hours in the timestamp conversion?

In this line I convert the current time into timestamp.

my $ hours_2 = str2time (localtime ());

But I need to know how to get two hours out of the result, getting $ hours_2 - two hours ... I'm not getting any way.

    
asked by anonymous 09.04.2017 / 04:08

1 answer

0

The Perl function localtime accepts a time parameter which is a Unix Epoch in the second unit. In Perl

localtime(time())

is the same as

localtime()

Knowing this, to get the result less than two hours, simply remove 2 * 60 * 60 = 7200 seconds from the

my $hours_2 = localtime(time() - 7200);
    
28.05.2017 / 20:21