Wrong conversion of unix timestamp to human time

Viewed 52

I'm trying to display how much time a user is connected.

but when i convert the unix timestamp to human time the H displays the current hour, instead of the timestamp hour.

echo date("H:i:s", "320");

result: 19:05:20

desired result: 00:05:20

1 Answers

this setting depends on the set server time reading, you can set this up with the .htaccess file by adding

php_value date.timezone 'Europe/Warsaw'

my zone is 'Europe/Warsaw' as in the example

here you have all of it List of Supported Timezones https://www.php.net/manual/en/timezones.php

then from that date time you set the counter

echo date("H:i:s", "-3280");
Related