Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   TBDev (http://www.bvlist.com/forumdisplay.php?f=20)
-   -   PHP Warning (http://www.bvlist.com/showthread.php?t=12363)

elvira 22nd May 2021 12:59

PHP Warning
 
Hello all,


I have this warning in announce.php, so what is to do.


Code:

[Sat May 22 12:55:52.087372 2021] [:error] [pid 19406] [client 86.61.53.162:36312] PHP Warning:  strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/admin/web/noviteti.net/public_html/announce.php on line 160
Code:

[Sat May 22 12:55:52.087409 2021] [:error] [pid 19406] [client 86.61.53.162:36312] PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and

line 160 and 161 is:


Code:

$dt = strtotime(date('Y-m-d H:i:s')) - 180;
$dt = sqlesc(date('Y-m-d H:i:s', $dt));


DND 22nd May 2021 13:53

  • Modifying php.ini.
  • Adding date_default_timezone call.
Instead of date you could use gmdate.

or easier..in your config.php or bittorrent.php or whatever global file you have just define the default timezone
date_default_timezone_set('Europe/London');

elvira 22nd May 2021 15:31

Like this


Code:

$dt = gmdate('Y-m-d H:i:s') - 180;
$dt = sqlesc(gmdate("Y-m-d H:i:s"));


Elena 22nd May 2021 15:46

Quote:

Originally Posted by elvira (Post 55519)
Like this


Code:

$dt = gmdate('Y-m-d H:i:s') - 180;
$dt = sqlesc(gmdate("Y-m-d H:i:s"));


Code:

$sec = 4*86400; // 4 days
$dt = sqlesc(get_date_time(gmtime() - $sec));

:coffee:


All times are GMT +2. The time now is 21:55.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.