PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Wstęp> <Kalendarz i rozszerzenia pokrewne
Last updated: Fri, 10 Oct 2008

view this page in

Data i Czas



add a note add a note User Contributed Notes
data/czas
JonathanCross.com
25-Jul-2008 10:13
<?php
// A demonstration of the new DateTime class and the
// fact that it fixes dates before 1970 and after 2038.
?>
<h2>PHP 2038 date bug demo (php version <?=phpversion()?>)</h1>
<div style='float:left;margin-right:3em;'>
<h3>OLD Buggy date()</h3>
<?
for ( $i = 1900; $i < 2050; $i++) {
 
$datep = "$i-01-01";
  print
"  Trying: $datep ... ";
  print
date("F j, Y", strtotime($datep));
  print
"<BR>";
}
?></div>
<div style='float:left;'>
  <h3>NEW DateTime Class (v 5.2+)</h3><?
 
for ( $i = 1900; $i < 2050; $i++) {
   
$datep = "$i-01-01";
   
$date = new DateTime($datep);
    print
"  Trying: $datep ... ";
    print
$date->format('F j, Y');
    print
"<BR>";
  }
?></div>

Wstęp> <Kalendarz i rozszerzenia pokrewne
Last updated: Fri, 10 Oct 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites