<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>Derick Rethans - tag: datetime</title>
    <link>http://derickrethans.nl/feed-datetime.xml</link>
    <description>This feed shows the latest 15 items with the tag datetime</description>
    <language>en-us</language>
    <copyright>All rights reserved - Derick Rethans</copyright>
    <managingEditor>derick@derickrethans.nl (Derick Rethans)</managingEditor>
    <pubDate>Thu, 03 Nov 2011 11:21:06 +0000</pubDate>
    <lastBuildDate>Thu, 03 Nov 2011 11:21:06 +0000</lastBuildDate>
    <generator>eZ Components Feed dev (http://ezcomponents.org/docs/tutorials/Feed)</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>60</ttl>
    <item>
      <title>Storing Date/Times in Databases</title>
      <link>http://derickrethans.nl/storing-date-time-in-database.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="storing_date_times_in_databases"/&gt;Storing Date/Times in Databases&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Monday, March 29th 2010, 16:47 BST&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;After my talk during &lt;a href="http://confoo.ca/en"&gt;ConFoo&lt;/a&gt; on &lt;a href="http://confoo.ca/en/2010/session/advanced-date-time-handling-with-php"&gt;Advanced Date/Time Handling&lt;/a&gt; I received a question about whether the UTC-offset, together with the date/time in years, months, days, hours, minutes and seconds, was enough for storing a date/time in a database and still being able to do calculations with this. The answer to this question was no, but it lead to an even more interesting discussion about what &lt;em&gt;would&lt;/em&gt; be enough to store an accurate date/time in a database.&lt;/p&gt;
      &lt;p&gt;Firstly let me explain why storing a UTC offset is not adequate at all for doing any sort of calculations. Right now (March 25th, 2010), Montreal is on the same time as Santiago (in Chile) with both a UTC offset of -4 hours. This means that for the same date/time (&lt;code&gt;2010-03-25
19:03&lt;/code&gt;) the same timestamp is generated (&lt;code&gt;1269558180&lt;/code&gt;). However if we want to add eight months (&lt;code&gt;2010-11-25 19:03&lt;/code&gt;) to the current time for each of those locations then the timestamps &lt;em&gt;should&lt;/em&gt; be different — &lt;code&gt;1290729780&lt;/code&gt; for Montreal and &lt;code&gt;1290722580&lt;/code&gt; for Santiago. It turns out that &lt;em&gt;neither&lt;/em&gt; of them is exactly a full 24 hour difference from &lt;code&gt;2010-03-25 19:03&lt;/code&gt; as is shown the following script:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
$s = '2010-03-25 19:03';
$montrealNow = date_create( "{$s} America/Montreal" )-&gt;format( 'U' );
$santiagoNow = date_create( "{$s} America/Santiago" )-&gt;format( 'U' );
$s = '2010-11-25 19:03';
$montrealThen = date_create( "{$s} America/Montreal" )-&gt;format( 'U' );
$santiagoThen = date_create( "{$s} America/Santiago" )-&gt;format( 'U' );

$hour = 60 * 60;
$day = 24 * $hour;

echo "Montreal:\n",
    $montrealNow, " - ",
    $montrealThen, "\n",
    ( ( $montrealThen - $montrealNow ) % $day ) / $hour, "\n\n";

echo "Santiago:\n",
    $santiagoNow, " - ",
    $santiagoThen, "\n",
    ( ( $santiagoThen - $santiagoNow ) % $day ) / $hour, "\n\n";

?&gt;

&lt;/pre&gt;
      &lt;p&gt;which gives the output:&lt;/p&gt;
      &lt;pre&gt;Montreal:
1269558180 - 1290729780
1

Santiago:
1269558180 - 1290722580
23

&lt;/pre&gt;
      &lt;p&gt;From this we see that Montreal has an extra hour and Santiago has an hour less. This is because Montreal changed from Daylight Savings Time to normal time and Santiago, being on the southern hemisphere, moved from normal time to Daylight Savings time.&lt;/p&gt;
      &lt;p&gt;Now if we had only the timestamp (&lt;code&gt;1269558180&lt;/code&gt;) and the UTC-offset, the only thing we could do would be to advance a specific number of days. In this case, there are 245 days, which makes (&lt;code&gt;245 * 24 * 60 * 60 =&lt;/code&gt; ) &lt;code&gt;21168000&lt;/code&gt; seconds. If we add this to the original timestamp, we end up at &lt;code&gt;1290726180&lt;/code&gt; which corresponds to &lt;code&gt;2010-11-25 18:03&lt;/code&gt; Montreal time, or &lt;code&gt;2010-11-25 20:03&lt;/code&gt; Santiago time. Neither of them being the correct &lt;code&gt;2010-11-25 19:03&lt;/code&gt;. Because from the UTC offset of 4 hours we don't know whether we're in Montreal or Santiago, we can conclude that with just this UTC offset and the original timestamp we can't calculate the timestamp of something that's 8 months in the future. Storing the UTC-offset can not change this fact either.&lt;/p&gt;
      &lt;p&gt;In order to to proper calculations, you need to keep information about the timezone itself. In PHP timezones are identified with identifiers such as &lt;code&gt;America/Montreal&lt;/code&gt;. If we store those alongside the timestamps, we can do the proper calculations. The following example demonstrates that:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
$timestamp = 1269558180;
$tzid      = 'America/Montreal';

$d = new DateTime( "@$timestamp" );
$d-&gt;setTimeZone( new DateTimeZone( $tzid ) );
$d-&gt;modify( '+8 months' );

echo $d-&gt;format( 'Y-m-d H:i' ), "\n";
?&gt;

&lt;/pre&gt;
      &lt;p&gt;which gives the output: &lt;code&gt;2010-11-25 19:03&lt;/code&gt;.&lt;/p&gt;
      &lt;p&gt;This seems to work, but unfortunately, even the approach of storing the timestamp and timezone identifier is not going to work correctly under certain circumstances. In order to find out why, we have to go back to January this year.&lt;/p&gt;
      &lt;p&gt;Imagine that in January this year—January 15th to be precise—we run the following script to determine the timestamp of a date/time two months in the future:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
$tz = 'America/Santiago';
$ts = date_create( "2010-01-15 10:41 $tz" )-&gt;format( 'U' );

$d = new DateTime( "@$ts" );
$d-&gt;setTimeZone( new DateTimeZone( $tz ) );
$d-&gt;modify( '+2 months' );

echo $d-&gt;format( 'U Y-m-d H:i' ), "\n";
?&gt;

&lt;/pre&gt;
      &lt;p&gt;This returns the timestamp &lt;code&gt;1268664060&lt;/code&gt; for the date/time &lt;code&gt;2010-03-15
10:41:00&lt;/code&gt;.&lt;/p&gt;
      &lt;p&gt;Now skip forwards to the current date and time. If we used this calculated timestamp and the timezone identifier &lt;code&gt;America/Santiago&lt;/code&gt; today to generate a date/time string, we would however get a different output. The following example shows this:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
$tz = 'America/Santiago';
$d = date_create( "@1268664060" );
$d-&gt;setTimeZone( new DateTimeZone( $tz ) );

echo $d-&gt;format( 'Y-m-d H:i:s' ), "\n";
?&gt;

&lt;/pre&gt;
      &lt;p&gt;which gives the output: &lt;code&gt;2010-03-15 11:41:00&lt;/code&gt; (and not &lt;code&gt;2010-03-15
10:41:00&lt;/code&gt;).&lt;/p&gt;
      &lt;p&gt;The difference in output is not a bug, but is caused because some countries change Daylight Savings Time rules quite frequently. In this case Chile decided (on March 4th) that instead of going forwards to DST at midnight March 14th, they will delay that to April 4th. When we ran the code on January 15th, the rules still thought that March 15th would already be on normal time again, outside of DST. But running the code now, with the updated rule set, we find that DST is still in effect until April 4th. The following example shows the transitions from/to DST for Santiago in 2010:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
$tzid = "America/Santiago";

$tz = new DateTimeZone( $tzid );
$transitions = $tz-&gt;getTransitions(
    strtotime( '2010-01-01 00:00 UTC' ),
    strtotime( '2010-12-31 00:00 UTC' )
);

foreach ( $transitions as $t )
{
    echo $t['time'], ' ', $t['offset'] / 3600, ' ', $t['abbr'], "\n";
}
?&gt;

&lt;/pre&gt;
      &lt;p&gt;If we run this script with PHP 5.3.1 or 5.3.2—which still have the old incorrect rule set—the output is:&lt;/p&gt;
      &lt;pre&gt;2010-01-01T00:00:00+0000 -3 CLST
2010-03-14T03:00:00+0000 -4 CLT
2010-10-10T04:00:00+0000 -3 CLST

&lt;/pre&gt;
      &lt;p&gt;In the SVN repository, the rule set has been updated, so snapshots of PHP 5.3-dev have the correct rules and the script will show:&lt;/p&gt;
      &lt;pre&gt;2010-01-01T00:00:00+0000 -3 CLST
2010-04-04T03:00:00+0000 -4 CLT
2010-10-10T04:00:00+0000 -3 CLST

&lt;/pre&gt;
      &lt;p&gt;This leads to the conclusion that storing timestamps and timezone identifiers is not good enough either, unless you want an &lt;em&gt;exact&lt;/em&gt; point in time, as opposed to the more expected date/time in a location. So how &lt;em&gt;should&lt;/em&gt; you store the latter then? Basically, in the same way that DateTime objects are serialized in PHP 5.3. Let us imagine again, that the following code is run on January 15th again:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
$tzid = 'America/Santiago';
$d = new DateTime( "2010-01-15 10:41 $tzid" );
$d-&gt;modify( '+2 months' );
$s = $d-&gt;format( 'Y-m-d H:i:s' );
$ts = $d-&gt;format( 'U' );
echo "$s (ts=$ts)\n";
?&gt;

&lt;/pre&gt;
      &lt;p&gt;which gives the output &lt;code&gt;2010-03-15 10:41:00 (ts=1268664060)&lt;/code&gt;. The next example is run with a recent rule set (such as in PHP SVN) today:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
$tzid = 'America/Santiago';
$d = new DateTime( "$s $tzid" );
$s = $d-&gt;format( 'Y-m-d H:i:s' );
$ts = $d-&gt;format( 'U' );
echo "$s (ts=$ts)\n";
?&gt;

&lt;/pre&gt;
      &lt;p&gt;which gives the output &lt;code&gt;2010-03-15 10:41:00 (ts=1268660460)&lt;/code&gt;. As you can see, now the date/time itself is correct, although there is a different timestamp. PHP's DateTime serialisation does something similar:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
$d = new DateTime();
$d-&gt;setTimeZone( new DateTimeZone( 'America/Santiago' ) );
var_dump( $d );
?&gt;

&lt;/pre&gt;
      &lt;p&gt;which gives the output:&lt;/p&gt;
      &lt;pre&gt;object(DateTime)#1 (3) {
  ["date"]=&gt;
  string(19) "2010-03-29 11:32:08"
  ["timezone_type"]=&gt;
  int(3)
  ["timezone"]=&gt;
  string(16) "America/Santiago"
}

&lt;/pre&gt;
      &lt;p&gt;For things to work correctly, you need to have an up-to-date rule set. PHP versions are not released as often as the timezonedb (sometimes more than 20 times a year) and to address this issue you can install the pecl extension &lt;a href="http://pecl.php.net/package/timezonedb"&gt;timezonedb&lt;/a&gt; with &lt;code&gt;pecl install timezonedb&lt;/code&gt;.&lt;/p&gt;
      &lt;p&gt;To store information in a database, I would use a &lt;code&gt;char&lt;/code&gt; column-type to store the whole &lt;code&gt;America/Santiago&lt;/code&gt; timezone identifier and another &lt;code&gt;char&lt;/code&gt; column-type to store the date/time (in the &lt;code&gt;yyyy-mm-dd
hh:ii:ss&lt;/code&gt; format).  Alternatively, you can pick a 'datetime' column-type, as long as that type &lt;strong&gt;ignores&lt;/strong&gt; timezones altogether. For MySQL that is the &lt;code&gt;DATETIME&lt;/code&gt; column-type, and for PostgreSQL the &lt;code&gt;TIMESTAMP&lt;/code&gt; or &lt;code&gt;TIMESTAMP WITHOUT TIME ZONE&lt;/code&gt; column-types.&lt;/p&gt;
      &lt;p&gt;Databases rarely handle timezones, daylight savings time and rule changes correctly, so avoid the database specific functionality all together. Using either a &lt;code&gt;char&lt;/code&gt; or a timezone-less 'datetime' column-type would still allow you to sort and by using a 'datetime' column-type you can even do calculations.&lt;/p&gt;
      &lt;p&gt;Happy summer time!&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201003291647</guid>
      <pubDate>Mon, 29 Mar 2010 15:47:00 +0000</pubDate>
    </item>
    <item>
      <title>Obtaining the next month in PHP</title>
      <link>http://derickrethans.nl/obtaining-the-next-month-in-php.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="obtaining_the_next_month_in_php"/&gt;Obtaining the next month in PHP&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Friday, January 8th 2010, 09:13 GMT&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;Over and over again PHP users complain that &lt;code&gt;next month&lt;/code&gt; in PHP's date-string parser doesn't go to the next month, but instead skips to the one after next month; like in the following example:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
$d = new DateTime( '2010-01-31' );
$d-&gt;modify( 'next month' );
echo $d-&gt;format( 'F' ), "\n";
?&gt;

&lt;/pre&gt;
      &lt;p&gt;The output of the little script will be &lt;code&gt;March&lt;/code&gt;. March obviously doesn't follow January as February is in between. However, the current behavior &lt;strong&gt;is&lt;/strong&gt; correct. The following happens internally:&lt;/p&gt;
      &lt;ul&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;next month&lt;/code&gt; increases the month number (originally 1) by one. This makes the date &lt;code&gt;2010-02-31&lt;/code&gt;.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;The second month (February) only has 28 days in 2010, so PHP auto-corrects this by just continuing to count days from February 1st. You then end up at March 3rd.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;The formatting strips off the year and day, resulting in the output &lt;code&gt;March&lt;/code&gt;.&lt;/p&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
      &lt;p&gt;This can easily be seen when echoing the date with a full date format, which will output &lt;code&gt;March 3rd, 2010&lt;/code&gt;:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
echo $d-&gt;format( 'F jS, Y' ), "\n";
?&gt;

&lt;/pre&gt;
      &lt;p&gt;To obtain the correct behavior, you can use some of PHP 5.3's new functionality that introduces the relative time stanza &lt;code&gt;first day of&lt;/code&gt;. This stanza can be used in combination with &lt;code&gt;next month&lt;/code&gt;, &lt;code&gt;fifth month&lt;/code&gt; or &lt;code&gt;+8 months&lt;/code&gt; to go to the &lt;strong&gt;first day&lt;/strong&gt; of the specified month. Instead of &lt;code&gt;next month&lt;/code&gt; from the previous example, we use &lt;code&gt;first day of next month&lt;/code&gt; here:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
$d = new DateTime( '2010-01-08' );
$d-&gt;modify( 'first day of next month' );
echo $d-&gt;format( 'F' ), "\n";
?&gt;

&lt;/pre&gt;
      &lt;p&gt;This script will correctly output &lt;code&gt;February&lt;/code&gt;. The following things happen when PHP processes this &lt;code&gt;first day of next month&lt;/code&gt; stanza:&lt;/p&gt;
      &lt;ul&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;next month&lt;/code&gt; increases the month number (originally 1) by one. This makes the date &lt;code&gt;2010-02-31&lt;/code&gt;.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;first day of&lt;/code&gt; sets the day number to 1, resulting in the date &lt;code&gt;2010-02-01&lt;/code&gt;.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;The formatting strips off the year and day, resulting in the output &lt;code&gt;February&lt;/code&gt;.&lt;/p&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
      &lt;p&gt;Besides &lt;code&gt;first day of&lt;/code&gt;, there is an equivalent &lt;code&gt;last day of&lt;/code&gt; to go to the last day of a month. The following example demonstrates this:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
$d = new DateTime( '2010-01-08' );
$d-&gt;modify( 'last day of next month' );
echo $d-&gt;format( 'F jS, Y' ), "\n";
?&gt;

&lt;/pre&gt;
      &lt;p&gt;This outputs &lt;code&gt;February 28th, 2010&lt;/code&gt;. Internally the following happens:&lt;/p&gt;
      &lt;img src="http://derickrethans.nl/images/content/datebook-cover.jpg" class="right" alt="datebook-cover.jpg"/&gt;
      &lt;ul&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;next month&lt;/code&gt; increases the month number (originally 1) by one. This makes the date &lt;code&gt;2010-02-08&lt;/code&gt;.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;&lt;code&gt;last day of&lt;/code&gt; increases the month number by one, and sets the day number to 0, resulting in the date &lt;code&gt;2010-03-00&lt;/code&gt;.&lt;/p&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;p&gt;PHP then auto-corrects the invalid day number 0 by removing one from the month and skipping to the last day of that month, resulting in &lt;code&gt;2010-02-28&lt;/code&gt;.&lt;/p&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
      &lt;p&gt;I hope this clears up some of the behaviour of PHP's Date/Time handling. For more information on Date/Time Programming with PHP, please refer to my book "&lt;a href="http://tinyurl.com/phpdatebookuk"&gt;php|architect's Guide to Date and Time Programming&lt;/a&gt;" that is available through &lt;a href="http://tinyurl.com/phpdatebookuk"&gt;Amazon&lt;/a&gt;.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>201001080913</guid>
      <pubDate>Fri, 08 Jan 2010 09:13:00 +0000</pubDate>
    </item>
    <item>
      <title>Unix Epoch and PHP's calendar system</title>
      <link>http://derickrethans.nl/unix-epoch-and-phps-calendar-system.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="unix_epoch_and_php_s_calendar_system"/&gt;Unix Epoch and PHP's calendar system&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Thursday, November 12th 2009, 12:32 GMT&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;I just saw a &lt;a href="http://news.php.net/php.doc.cvs/5325"&gt;commit&lt;/a&gt; flying past as a response to &lt;a href="http://bugs.php.net/bug.php?edit=1&amp;id=50155"&gt;PHP bug #50155&lt;/a&gt;. While &lt;em&gt;right&lt;/em&gt; now it is proper to define the Unix Epoch at "1970-01-01 00:00:00 UTC", UTC wasn't actually defined until 1972. So it would be more correct to define the Unix Epoch as "the number of seconds elapsed since midnight &lt;a href="http://dictionary.reference.com/browse/proleptic"&gt;proleptic&lt;/a&gt; Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds." (from Wikipedia). What the bit "not counting leap seconds" means, I've already explained before in &lt;a href="http://derickrethans.nl/leap_seconds_and_what_to_do_with_them.php"&gt;Leap Seconds and What To Do With Them&lt;/a&gt;.&lt;/p&gt;
      &lt;p&gt;Similarly, PHP's internal calendar is the &lt;a href="http://en.wikipedia.org/wiki/ISO_8601#Years"&gt;ISO 8601 calendar&lt;/a&gt;. This is a modification of the proleptic &lt;a href="http://en.wikipedia.org/wiki/Gregorian_calendar"&gt;Gregorian&lt;/a&gt; calendar. The Gregorian calendar implements the current set of leap years every 4 years, but not every 100 years, but again every 400 years (to get to an average year length of 365.2425 days). Obviously this calendar is only in use since 1582 (some countries adopted it as late as the 1900s), so using days like 1066-10-14 in the Gregorian calendar makes little sense because that calendar didn't exist back then. Now, PHP's ISO 8601-based calendar even modifies the Gregorian calendar by including the year 0. The Gregorian calendar goes straight from -1 to 1 which is a pain to do proper date calculations with. Therefore the ISO 8601 calendar uses &lt;a href="http://en.wikipedia.org/wiki/Astronomical_year_numbering"&gt;Astronomical year numbering&lt;/a&gt;.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>200911121232</guid>
      <pubDate>Thu, 12 Nov 2009 12:32:00 +0000</pubDate>
    </item>
    <item>
      <title>php|architect's Guide to Date and Time Programming</title>
      <link>http://derickrethans.nl/phparchitects-guide-to-date-and-time-programming.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="php_architect_s_guide_to_date_and_time_programming"/&gt;php|architect's Guide to Date and Time Programming&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; Skien, Norway&lt;/div&gt;
        &lt;div class="date"&gt;Wednesday, June 3rd 2009, 21:06 CEST&lt;/div&gt;
      &lt;/div&gt;
      &lt;img src="http://derickrethans.nl/images/content/datebook-cover.jpg" class="left" alt="datebook-cover.jpg"/&gt;
      &lt;p&gt;In the past year I've been working on a book, describing PHP's Date and Time functionality in great detail. It's now finally out under the name " &lt;a href="http://phpdatebook.com"&gt;php|architect's Guide to Date and Time Programming&lt;/a&gt; ". Look at the pretty cover! It's actually a picture I took some months ago from the church in &lt;a href="http://en.wikipedia.org/wiki/Skien"&gt;Skien&lt;/a&gt; , where I am &lt;em&gt;still&lt;/em&gt; living (more about that in a later post).&lt;/p&gt;
      &lt;p&gt;The book is devoted on helping you understanding dates and times, as well as how PHP deals with it. It explains how PHP parsers and reads dates and times in strings including possible pitfalls; timezones, their history, the annoyances and how to deal with them properly; formatting and displaying dates and times; and last but not least, how to handle intervals and iterating over time. There is more information on the &lt;a href="http://phparch.com/c/books/id/9780981034508"&gt;website&lt;/a&gt; where you can also buy this awesome book. And in case you're wondering "what? dates and times are really simple!", then this book is &lt;em&gt;definitely&lt;/em&gt; for you.&lt;/p&gt;
      &lt;p&gt;Rumour is that all attendees of the &lt;a href="http://phpconference.nl"&gt;Dutch PHP Conference&lt;/a&gt; will receive a copy with their tickets, if you're asking nicely I might even sign your copy! I'll be there to give a talk on "PHP on the D-BUS" and will show you how to talk to skype, GSM chips and other desktoppy things!&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>200906032106</guid>
      <pubDate>Wed, 03 Jun 2009 19:06:00 +0000</pubDate>
    </item>
    <item>
      <title>Leap Seconds and What To Do With Them</title>
      <link>http://derickrethans.nl/leap-seconds-and-what-to-do-with-them.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="leap_seconds_and_what_to_do_with_them"/&gt;Leap Seconds and What To Do With Them&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; Skien, Norway&lt;/div&gt;
        &lt;div class="date"&gt;Thursday, January 1st 2009, 23:03 CET&lt;/div&gt;
      &lt;/div&gt;
      &lt;img src="http://derickrethans.nl/images/content/clock.jpg" class="right" alt="clock.jpg"/&gt;
      &lt;p&gt;The start of this new year started with some buzz about a &lt;a href="http://en.wikipedia.org/wiki/Leap_second"&gt;leap second&lt;/a&gt; being introduced between Dec 31st 2008, 23:59:59 and Jan 1st 2009, 00:00:00. I've had people ask where this leap second actually comes from, and whether you need to worry about it in your applications. To understand leap seconds means, unfortunately, understanding how time is actually kept.&lt;/p&gt;
      &lt;p&gt;There are many different time keeping scales. They are either defined as an arbitrary value, or obtained from astronomical observations. First of all, there are the variants of &lt;a href="http://en.wikipedia.org/wiki/Universal_Time#Versions"&gt;Universal Time&lt;/a&gt;. UT1 is the principal form of Universal Time. UT1 is the same all over the world, and is related to the Earths rotation. The rotation speed of the Earth is not precise, and is slowed down by the tidal friction of the Moon among things. Obviously, this is a bad base to build a stable and precise timekeeping scale on.&lt;/p&gt;
      &lt;p&gt;An (SI) second is nowadays defined as "the duration of 9 192 631 770 periods of the radiation corresponding to the transition between the two hyperfine levels of the ground state of the caesium 133 atom". This can be measured very accurately by atomic clocks and is the base for &lt;a href="http://en.wikipedia.org/wiki/International_Atomic_Time"&gt;International Atomic Time&lt;/a&gt; (TAI, from Temps Atomique International). This scale however, does not take into account the gradual but increasing slowing down of the Earth's rotation and will therefore not reflect the approximation to "mean solar time" over longer periods of time. This makes it useless as a civil timekeeping scale.&lt;/p&gt;
      &lt;p&gt;For the latter purpose, &lt;a href="http://en.wikipedia.org/wiki/Coordinated_Universal_Time"&gt;Coordinated Universal Time&lt;/a&gt; (UTC, from Universal Time, Coordinated) has been established. UTC uses SI seconds but is adjusted for the slowing down of Earths rotation with leap seconds. Because it's not possible to predict the rotation of the Earth upfront, leap seconds are only added when the difference between UTC and UT1 approaches 0.6 SI seconds in order to keep UTC and UT1 not differ from each other for more than 0.9 seconds. UTC was defined (in the latest adjustment of its definition) as being 10 seconds different from TAI making 1972-01-01T00:00:00 UTC and 1972-01-01T00:00:10 TAI the same instant. Since 1972, 24 leap seconds have been introduced, making TAI differ from UTC with 34 seconds currently. As the Earth's rotation is slowing down at an ever increasing rate, the use of leap seconds will get more and more annoying. After the 25th century, it is likely that more than 4 leap seconds would be required every year. This is of course highly unpractical and a solution needs to be found for this.&lt;/p&gt;
      &lt;p&gt;There are two other timescales based on TAI. &lt;a href="http://en.wikipedia.org/wiki/Terrestrial_Time"&gt;Terrestial Time&lt;/a&gt; (TT) as the modern astronomical standard for the passage of time. TT is defined as TAI + 32.184 seconds. &lt;a href="http://en.wikipedia.org/wiki/Global_Positioning_System#Timekeeping"&gt;GPS Time&lt;/a&gt;, as used by GPS satellites and receivers, was set to match UTC in 1980, but now deviates with 15 seconds due to the addition of leap seconds in UTC. GPS Time is defined as TAI - 19 seconds.&lt;/p&gt;
      &lt;p&gt;Greenwich Mean Time (GMT) is often used as synonym for UTC, although that is strictly not correct. GMT is an astronomical concept and therefore linked to UT1. Greenwich Mean Time is &lt;em&gt;also&lt;/em&gt; used as timezone name for a timezone with zero seconds offset from UTC. It is for example used in winter in the UK and Ireland. During the summer, when the UK and Ireland switch to daylight savings time, GMT is not used at all. British Summer Time (BST) and Ireland Summer Time (IST) are then used instead.&lt;/p&gt;
      &lt;p&gt;A thing to realize is that leap seconds are added only at the end of June 30th and December 31st. The seconds are added at 23:59:59 &lt;em&gt;UTC&lt;/em&gt; . This means that there is no need to add an extra second while counting down to the new year unless you're in a timezone that is UTC +0 seconds (such as GMT, or WET). Of course, in other locations the leap second is inserted as well at the same time. In Norway, the leap second was added at Jan 1st, 2009, at 00:59:59 for example.&lt;/p&gt;
      &lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Unix_time"&gt;Unix time&lt;/a&gt; (also called POSIX time) is defined as the number of seconds since Jan 1st 1970, 00:00 UTC, but without leap seconds. Although it is called &lt;em&gt;Unix time&lt;/em&gt; , this timekeeping standard is used widely in many other operating systems and computing devices. Unix time simply counts the number of seconds since the epoch. A date/time expressed in those seconds is often called a Unix time stamp. Not supporting leap seconds means that Unix time does not have any way to represent the leap second in the form of 23:59:60. Instead it just uses the same second twice. In practical terms, that means that Unix time progressed like this during the year transition: 1230767999, 1230768000, 1230768000 and 1230768001. The first 1230768000 represents 2008-12-31 23:59:60 UTC, and the second 1230768000 represents 2009-01-01 00:00:00 UTC. For applications there is no way to differentiate between the two distinct times, although many applications will accept both as input, like this PHP example shows:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
echo strtotime("2008-12-31 23:59:59 UTC"), "\n";
echo strtotime("2008-12-31 23:59:60 UTC"), "\n";
echo strtotime("2009-01-01 00:00:00 UTC"), "\n";
echo strtotime("2009-01-01 00:00:01 UTC"), "\n";
?&gt;

&lt;/pre&gt;
      &lt;p&gt;In order to synchronize the system time the &lt;a href="http://en.wikipedia.org/wiki/Network_Time_Protocol"&gt;Network Time Protocol&lt;/a&gt; (NTP) is widely used. NTP can use different sources of time information in an hierarchical fashion. The protocol knows how to deal with leap seconds to provide the correct Unix time stamp.&lt;/p&gt;
      &lt;p&gt;To recap the above information: UT1 is based on the actual rotational speed of the Earth and is therefore never accurate. TAI is a time scale based on the actual count of SI seconds. UTC also uses SI seconds, but requires a leap second in order not to deviate from the unstable UT1 which is in sync with the average time of when the Sun is due South (mean solar time). Unix time counts SI seconds, and resembles UTC except that instead of leap seconds, the Unix time stamp is simply used twice. GMT is both a different name for UT1 &lt;em&gt;and&lt;/em&gt; a name for a timezone with an UTC offset of 0 seconds. PHP uses Unix time, and does not care about leap seconds.&lt;/p&gt;
      &lt;p&gt;Happy New Year!&lt;/p&gt;
      
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>200901012303</guid>
      <pubDate>Thu, 01 Jan 2009 22:03:00 +0000</pubDate>
    </item>
    <item>
      <title>Detecting Timezone By IP</title>
      <link>http://derickrethans.nl/detecting-timezone-by-ip.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="detecting_timezone_by_ip"/&gt;Detecting Timezone By IP&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; Skien, Norway&lt;/div&gt;
        &lt;div class="date"&gt;Tuesday, May 6th 2008, 22:09 CEST&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;Through &lt;a href="http://planet-php.org"&gt;Planet PHP&lt;/a&gt; I found an article on &lt;a href="http://torrentialwebdev.com/blog/archives/152-Pre-populating-forms-with-the-timezone.html"&gt;Pre-populating forms with the timezone&lt;/a&gt; . I'd normally add a comment instead, but the comment would almost be larger then the original post, so I am instead writing up an entry myself. The post describes several ways to obtain the user's timezone and use that to pre-fill a form. None of them are working properly though. I'll try to explain for each of them why not, but first of all it is important to know what a timezone actually is.&lt;/p&gt;
      &lt;p&gt;A timezone is a set of rules that determines the UTC offset for different times around the year for a &lt;em&gt;specific&lt;/em&gt; location. Because of daylight savings time, a specific location can have two (or more) different UTC offsets depending on what point in time you look at it. Some areas might have had different rules in the past, even in the same country. An example here is China, where &lt;em&gt;currently&lt;/em&gt; there is only one timezone, but previously there were multiple. Thus there are &lt;em&gt;different&lt;/em&gt; timezones for the different locations in China, even though the &lt;em&gt;current&lt;/em&gt; UTC offset is the same for all of them. Timezones are identified by Country/City or Country/Subcountry/City.&lt;/p&gt;
      &lt;p&gt;The offering by &lt;a href="http://www.maxmind.com/app/city"&gt;MaxMind&lt;/a&gt; allows you to link a country/region combination to Timezone identifier. For the US it subdivides this per state even. However, it misses the different timezones for Russia, Australia and even Indiana, USA.&lt;/p&gt;
      &lt;p&gt;&lt;a href="http://www.ip2location.com/ip-country-region-city-latitude-longitude-zipcode-timezone.aspx"&gt;IP2Location&lt;/a&gt; only provides a single UTC offset per IP range, totally ignoring daylight savings time.&lt;/p&gt;
      &lt;p&gt;The &lt;a href="http://www.hostip.info/dl/index.html"&gt;Hostip.info&lt;/a&gt; solution I can't access because phpclasses requires some stupid registration.&lt;/p&gt;
      &lt;p&gt;As for the author's own solution, using JavaScript, is flawed at least partly as well. In his example JavaScript only returns a UTC offset. Luckily it is possible to detect the correct &lt;em&gt;timezone&lt;/em&gt; quite a bit better by using some of PHP's functionality. The following bit of code uses both the UTC offset and the timezone abbreviation to find out the user's timezone:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
if (!isset($_GET['tzinfo'])) {
?&gt;
&lt;html&gt;
&lt;script type="text/javascript"&gt;
var d = new Date()
var tza = d.toLocaleString().split(" ").slice(-1)
var tzo = d.getTimezoneOffset()
window.location = window.location + '?tzinfo=' + tza + '|' + tzo
&lt;/script&gt;
&lt;/html&gt;
&lt;?php
} else {
list( $abbr, $offset ) = explode( '|', $_GET['tzinfo']);
echo timezone_name_from_abbr( $abbr, $offset * -60 );
}
?&gt;

&lt;/pre&gt;
      &lt;p&gt;This is still not perfect of course, because it would for example give the same result for most of Europe (Europe/Berlin).&lt;/p&gt;
      &lt;p&gt;Figuring out the user's timezone &lt;em&gt;can&lt;/em&gt; be done by using a high-accuracy database of IPs to lat/longitudes such as &lt;a href="http://www.hostip.info/dl/index.html"&gt;hostip.info&lt;/a&gt; and &lt;a href="http://www.maxmind.com/app/city"&gt;MaxMind&lt;/a&gt; offer, as well as a mapping from location to timezone. The latter however, is not available as far as I know. If however a data file that has proper definitions of the different timezone boundaries exist (mostly, on a per-province level would be enough), then such a tool can be easily build. I saw that &lt;a href="http://www.openstreetmap.org/"&gt;OpenStreetMap&lt;/a&gt; has such a map, but I can't really find the raw data for that unfortunately. It would however, be awesome to have such a data file.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>200805062209</guid>
      <pubDate>Tue, 06 May 2008 20:09:00 +0000</pubDate>
    </item>
    <item>
      <title>British date format parsing</title>
      <link>http://derickrethans.nl/british-date-format-parsing.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="british_date_format_parsing"/&gt;British date format parsing&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; London, UK&lt;/div&gt;
        &lt;div class="date"&gt;Sunday, March 2nd 2008, 20:25 GMT&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;During the &lt;a href="http://phpconference.co.uk"&gt;PHP London&lt;/a&gt; conference (slides are &lt;a href="http://derickrethans.nl/talks.php"&gt;here&lt;/a&gt; as usual), a number of British people were "complaining" that PHP's &lt;a href="http://php.net/strtotime"&gt;strtotime()&lt;/a&gt; and &lt;a href="http://php.net/date_create"&gt;date_create()&lt;/a&gt; /new DateTime() functions do not understand the British date format "dd/mm/yyyy". Historically, the "English" text to date parsers in PHP only accept the illogical American format of "mm/dd/yyyy". Having seen this problem before, I recently added a new function/method to PHP's Date/Time support to address exactly this issue. From PHP 5.3 the new date_create_from_format() function and the DateTime::createFromFormat() factory method are available. As first argument they accept the expected format, and as second argument the string to parse. To parse a British date string, you would for example use:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
$dt = date_create_from_format( 'd/m/Y', "02/03/2008" );
echo $dt-&gt;format( 'd/m/Y' ), "\n";
?&gt;

&lt;/pre&gt;
      &lt;p&gt;In case the passed string does not match the format, the function will return false. With the also new function date_get_last_errors() method you then can request more information about which part of the string could not be passed. The following example illustrates that:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
$dt = date_create_from_format( 'Y-m-d', "02/03/2008" );
if ( !$dt )
{
    $errors = date_get_last_errors();
    var_dump( $errors['errors']);
}
?&gt;

&lt;/pre&gt;
      &lt;p&gt;The $errors contains a list of errors, indexed by the position in the string where the error was found. The above script would produce:&lt;/p&gt;
      &lt;pre&gt;array(3) {
  [2]=&gt;
  string(22) "Unexpected data found."
  [5]=&gt;
  string(22) "Unexpected data found."
  [8]=&gt;
  string(13) "Trailing data"
}

&lt;/pre&gt;
      &lt;p&gt;The format specifiers are mostly similar to the ones used for the &lt;a href="http://php.net/date"&gt;date()&lt;/a&gt; function. Documentation on the new functions should make it into the documentation soon.&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>200803022025</guid>
      <pubDate>Sun, 02 Mar 2008 20:25:00 +0000</pubDate>
    </item>
    <item>
      <title>The Y2K7 problem</title>
      <link>http://derickrethans.nl/the-y2k7-problem.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="the_y2k7_problem"/&gt;The Y2K7 problem&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; Skien, Norway&lt;/div&gt;
        &lt;div class="date"&gt;Tuesday, March 6th 2007, 23:04 CET&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;Right, that "Y2K7" is not a typo. It "refers to the Year 2007 problem, caused by a US-mandated change to Daylight Saving Time" ( &lt;a href="http://en.wikipedia.org/wiki/Y2K7"&gt;wikipedia&lt;/a&gt; ). From this year the US (and Canada) changed the dates on when daylight saving time is active. DST now starts three weeks earlier, and ends one week later. This causes quite a lot of problems with software that hard coded those rules. On Linux (and other Unix-like operating systems) this can be remedied by updating the zoneinfo information - check your Operating System's documentation on how to do that.&lt;/p&gt;
      &lt;p&gt;PHP before PHP 5.1.0 relies on the Operating System to provide time zone information, while PHP versions 5.1.0 and higher come with a bundled time zone database. The database that ships with PHP 5.1.0 already covers the changes in the US and Canada, however, the US and Canada are not the only places changing rules. Many places on earth change those rules all the time which means PHP's database needs to be updated as well.&lt;/p&gt;
      &lt;p&gt;Every PHP version comes with the latest release of the time zone database at the moment PHP is released. However, it is also possible to just update this data by installing the PECL extension &lt;a href="http://pecl.php.net/package/timezonedb"&gt;timezonedb&lt;/a&gt; . This extension is released whenever a new version of the &lt;a href="http://www.twinsun.com/tz/tz-link.htm"&gt;Olson database&lt;/a&gt; becomes available. The current version is 2007c (2007.3).&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>200703062304</guid>
      <pubDate>Tue, 06 Mar 2007 22:04:00 +0000</pubDate>
    </item>
    <item>
      <title>Calculating start and end dates of a week.</title>
      <link>http://derickrethans.nl/calculating-start-and-end-dates-of-a-week.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="calculating_start_and_end_dates_of_a_week"/&gt;Calculating start and end dates of a week.&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; Skien, Norway&lt;/div&gt;
        &lt;div class="date"&gt;Wednesday, September 6th 2006, 09:25 CEST&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;A friend asked "How do I calculate start (monday) and end (sunday) dates from a given week number for a specified year?" Instead of having to come up with your own algorithm you can simply do the following in PHP 5.1 and higher:&lt;/p&gt;
      &lt;pre&gt;&lt;?php
// Monday
echo date(
    datetime::ISO8601,
    strtotime("2006W37"));

// Sunday
echo date(
    datetime::ISO8601,
    strtotime("2006W377"));
?&gt;

&lt;/pre&gt;
      &lt;p&gt;The format is " &lt;em&gt;year&lt;/em&gt; 'W' &lt;em&gt;weeknr&lt;/em&gt; ( &lt;em&gt;daynr&lt;/em&gt; )?" where the default &lt;em&gt;daynr&lt;/em&gt; is 1 being the Monday of that week. The &lt;em&gt;daynr&lt;/em&gt; can be in the range 0 to 7. The &lt;em&gt;weeknr&lt;/em&gt; is the &lt;a href="http://en.wikipedia.org/wiki/ISO_week_date"&gt;ISO week number&lt;/a&gt; . Please note that the " &lt;em&gt;year&lt;/em&gt; '-W' &lt;em&gt;weeknr&lt;/em&gt; ( '-' &lt;em&gt;daynr&lt;/em&gt; )?" format is only supported in PHP 5.2 and higher.&lt;/p&gt;
      
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>200609060925</guid>
      <pubDate>Wed, 06 Sep 2006 07:25:00 +0000</pubDate>
    </item>
    <item>
      <title>PHP lags 23 seconds</title>
      <link>http://derickrethans.nl/php-lags-23-seconds.html</link>
      <description>&lt;div class="article"&gt;
  &lt;div class="body"&gt;
    &lt;div class="articleListItem"&gt;
      &lt;h1&gt;&lt;a name="php_lags_23_seconds"/&gt;PHP lags 23 seconds&lt;/h1&gt;
      &lt;dl class="head"/&gt;
      &lt;div class="articleMetaData"&gt;
        &lt;div class="location"&gt; Skien, Norway&lt;/div&gt;
        &lt;div class="date"&gt;Tuesday, January 10th 2006, 20:35 CET&lt;/div&gt;
      &lt;/div&gt;
      &lt;p&gt;Bug report # &lt;a href="http://bugs.php.net/35958"&gt;35958&lt;/a&gt; must have the most obscure one ever:&lt;/p&gt;
      &lt;p&gt;"strftime usually returns a string from the number of seconds since 1 jan 1970. Now, it lags and returns a string representing 23 seconds too late."&lt;/p&gt;
      &lt;p&gt;If you know what's going on though, it isn't really that weird. Every once in a while the &lt;a href="http://en.wikipedia.org/wiki/International_Earth_Rotation_and_Reference_Systems_Service"&gt;IERS&lt;/a&gt; announces a new &lt;a href="http://en.wikipedia.org/wiki/Leap_second"&gt;leap second&lt;/a&gt; to "keep the broadcast standards for time of day close to &lt;a href="http://en.wikipedia.org/wiki/Mean_solar_time"&gt;mean solar time&lt;/a&gt; ". At the moment the difference is 23 seconds which is reflected in comparing the leap second adjusted time zone information file with the non-adjusted one. You can see the leap second with this little shell script:&lt;/p&gt;
      &lt;pre&gt;#!/bin/bash
export TZ=Europe/Amsterdam
date --date "@1136073621"
date --date "@1136073622"
date --date "@1136073623"
export TZ=right/Europe/Amsterdam
date --date "@1136073621"
date --date "@1136073622"
date --date "@1136073623"

&lt;/pre&gt;
      &lt;p&gt;The output is:&lt;/p&gt;
      &lt;pre&gt;Sun Jan  1 01:00:21 CET 2006
Sun Jan  1 01:00:22 CET 2006
Sun Jan  1 01:00:23 CET 2006
Sun Jan  1 00:59:59 CET 2006
Sun Jan  1 00:59:60 CET 2006
Sun Jan  1 01:00:00 CET 2006

&lt;/pre&gt;
      &lt;p&gt;The output with the "right/Europe/Amsterdam" timezone is actually the correct time, but this will obviously confused too many computer programs. Most often you will not see this one in use.&lt;/p&gt;
      &lt;p&gt;The new date/time code in PHP 5.1 does not support the leap second either. I was playing with it while developing, but thought it to be to confusing. Seems I was right there :)&lt;/p&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</description>
      <guid>200601102035</guid>
      <pubDate>Tue, 10 Jan 2006 19:35:00 +0000</pubDate>
    </item>
  </channel>
</rss>

