Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Strtotime
sky993
post
Post #1





Grupa: Zarejestrowani
Postów: 33
Pomógł: 0
Dołączył: 21.07.2011

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


Szukalem w manualu lecz autorzy nie podaja czy ta funkcja uwzglednia lata przestepne.
Dokładniej rzecz biorac che jej uzyc w nastepujacy sposob:
strtotime('+1 day',$data)
Czy uwzgledni ona 29 luty w przypadku roku przestepnego?
Go to the top of the page
+Quote Post
Crozin
post
Post #2





Grupa: Zarejestrowani
Postów: 6 476
Pomógł: 1306
Dołączył: 6.08.2006
Skąd: Kraków

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


Przestaw sobie datę na komputerze i sprawdź?
Go to the top of the page
+Quote Post
sadistic_son
post
Post #3





Grupa: Zarejestrowani
Postów: 1 495
Pomógł: 245
Dołączył: 1.07.2009
Skąd: Bydgoszcz

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


Lub czytaj manual dokładnie:
Cytat
Adding a note to an already long page:

Try to be as specific as you can with the string you pass in. For example

<?php
echo date('F', strtotime('February'));
?>

is not specific enough. Depending on the day of the month, you may get a different response. For a non-leap year, you'll get March if the _current day of the month_ is the 29th, 30th or 31st. If it's a leap year, you'll get March on the 30th or 31st of the month. The same thing will happen on the 31st of any month when you pass in the name of any month with less than 31 days. This happens because the strtotime() function will fill in missing parts from the current day.

Assuming today is July 31, the timestamp returned by strtotime('February') will ultimately be seen as February 31 (non-existant obviously), which then is interpreted as March 3, thus giving a month name of March.

Interestingly, adding the year or the day will give you back the expected month.
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 5.10.2025 - 06:59