Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> DateTime i osrzeżenie Strict Standards
NeVeS
post 1.04.2008, 20:22:30
Post #1





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 25.03.2005

Ostrzeżenie: (0%)
-----


Poniższy kod:
Kod
$date = new DateTime();    
$date->setTimezone(new DateTimeZone('Europe/Warsaw'));
$dzisiaj = $date->format("Y-m-d");

generuje poniższe ostrzeżenie:
Cytat
Strict Standards: DateTime::__construct() [function.DateTime---construct]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable 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/Paris' for '2.0/DST' instead in E:\htdocs\bc\trunk\lib\Statistic.class.php on line 55


Łaj? jak sie tego pozbyć ;-)?
Go to the top of the page
+Quote Post
czachor
post 1.04.2008, 20:26:55
Post #2





Grupa: Zarejestrowani
Postów: 897
Pomógł: 40
Dołączył: 16.12.2003
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


Na początek skryptu daj:
  1. <?php
  2. date_default_timezone_set('Europe/Warsaw');
  3. ?>
(lub inną strefę czasową).

//edit - brak apostrofów

Ten post edytował czachor 1.04.2008, 20:41:00


--------------------
how many SEO experts does it take to change a light bulb,lightbulb,light,bulb,lamp,lighting,switch,sex,xxx
5-Reasons-why-you-should-NEVER-fix-a-computer-for-free
Go to the top of the page
+Quote Post
NeVeS
post 1.04.2008, 20:34:47
Post #3





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 25.03.2005

Ostrzeżenie: (0%)
-----


Działa tylko że to takie nie obiektowe rozwiazania ... ;-)
Go to the top of the page
+Quote Post
Piniek
post 1.04.2008, 20:35:49
Post #4





Grupa: Przyjaciele php.pl
Postów: 463
Pomógł: 49
Dołączył: 27.12.2007
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


to dodaj sobie do tej klasy metode która to ustawia ;] pozostaje tylko pytanie po co ?

@batman: sorki spieszyłem się

Ten post edytował Piniek 1.04.2008, 20:51:01


--------------------
Go to the top of the page
+Quote Post
batman
post 1.04.2008, 20:49:04
Post #5





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




Cytat(Piniek @ 1.04.2008, 21:35:49 ) *
(...)ktura(...)

Sorki za OT, ale krew mnie zalewa. To słowo pisze się tak: która!


--------------------
I would love to change the world, but they won't give me the source code.
My software never has bugs. It just develops random features.
Go to the top of the page
+Quote Post
mike
post 1.04.2008, 21:16:12
Post #6





Grupa: Przyjaciele php.pl
Postów: 7 494
Pomógł: 302
Dołączył: 31.03.2004

Ostrzeżenie: (0%)
-----


Cytat(NeVeS @ 1.04.2008, 21:34:47 ) *
Działa tylko że to takie nie obiektowe rozwiazania ... ;-)
Zdefiniuj domyślą strefę czasową w pliku php.ini
Służy do tego dyrektywa date.timezone
Możesz wybrać spośród wspieranych stref czasowych.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 19.07.2025 - 12:41