Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP] Problem z dodaniem dat
Forum PHP.pl > Forum > Przedszkole
o2w5n778
Witam!
Mam oto taki kod:
  1. <?php
  2. $data = date("Y-m-d");;
  3.  
  4. $dni = 500;
  5.  
  6. $data = strtotime($data);
  7.  
  8. $data = $data + $dni * 24 * 3600;
  9.  
  10. $data = date('Y-m-d H:i:s',$data);
  11. ?>

Zwraca mi takie błędy:
Warning: date() [function.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 you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead in /usr/local/www/apache22/data/register.php on line 52

Warning: strtotime() [function.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 'Europe/Berlin' for 'CET/1.0/no DST' instead in /usr/local/www/apache22/data/register.php on line 56

Warning: date() [function.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 you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead in /usr/local/www/apache22/data/register.php on line 60

W czym problem?
piotrooo89
nie masz ustawionej w php.ini strefy czasowej.
Bateria
A wie ktoś jak to zmienić na apache?
johny_s
Cytat(Bateria @ 30.12.2011, 15:15:49 ) *
A wie ktoś jak to zmienić na apache?

no przeciez kolega wyzej napisal ze w php.ini
http://php.net/manual/pl/datetime.configuration.php
piotrooo89
w php.ini:
date.timezone = "TWOJA_STREFA"

lub bezpośrednio w appie za pomocą:
date_default_timezone_set

Jakbyś nie wiedział jakie sa strefy czasowe poczytaj link do manuala.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.