<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Thu, 20 Jun 2013 03:25:05 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Websanova.com: Timezones, the Right Way]]></title>
      <guid>http://www.phpdeveloper.org/news/18892</guid>
      <link>http://www.phpdeveloper.org/news/18892</link>
      <description><![CDATA[<p>
On the Websanova.com site there's a recent post about doing <a href="http://www.websanova.com/tutorials/php/timezones-the-right-way#.UMshCJPjmjQ">timezones the right way</a> when working with them in PHP and storing them in your (MySQL) database.
</p>
<blockquote>
Timezones are actually a very trivial concept but they seem to be overlooked and over complicated. [...] Rather than storing a timezone with each date it's better to just accept a standard time to store all your dates with, thus doing the conversion to that standard time before storing the value in the database. It doesn't really matter what time we store it as, but it's generally a good idea to just use UTC+00:00.
</blockquote>
<p>
They talk a little about what the UTC timezone is for those that may not know and show how to set it as the default timezone for your PHP application (with <a href="http://php.net/date_default_timezone_set">date_default_timezone_set</a> or updating your php.ini). They also include the MySQL configuration option to set its default timezone and and example SELECT statement for extracting the data back out.
</p>]]></description>
      <pubDate>Fri, 14 Dec 2012 10:17:21 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Derick Rethans' Blog: To GMT or not to GMT]]></title>
      <guid>http://www.phpdeveloper.org/news/17611</guid>
      <link>http://www.phpdeveloper.org/news/17611</link>
      <description><![CDATA[<p>
In <a href="http://derickrethans.nl/gmt-being-tricky.html">this new post</a> to his site, <i>Derick Rethans</i> shows an instance of "GMT being tricky" when it comes to "UTC" versus "GMT" output from PHP's DateTime object.
</p>
<blockquote>
Earlier today, on twitter, @skoop asked: "dear #lazyweb, when I use DateTimeZone('GMT'), why does format('e') output UTC?" [...] As you can see [the example with a format of "e" on a DateTimeZone('GMT')] has UTC and not GMT as you might expect.
</blockquote>
<p>
<i>Derick</i> mentions that sometimes, systems require "GMT" instead of "UTC" in the output they're given. To work around this issue, he shows how to add a "type 2" timezone to the DateTime object by including it when you initialize the object (code samples included). Using alternative methods, you can add these "type 2" timezones in three ways - an offset in the initial string, using the abbreviation (like "EST" or "PST") and specifying the long version of the timezone (like "America/Montreal").
</p>]]></description>
      <pubDate>Thu, 01 Mar 2012 11:39:45 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Derick Rethans' Blog: Storing Date/Times in Databases]]></title>
      <guid>http://www.phpdeveloper.org/news/14266</guid>
      <link>http://www.phpdeveloper.org/news/14266</link>
      <description><![CDATA[<p>
<i>Derick Rethans</i> has a new post to his blog that helps to demystify some of the confusion around <a href="http://derickrethans.nl/storing-date-time-in-database.html">storing dates correctly</a> in your application's database. He mentions a suggested method of using the UTC time and offset together, but talks about why this isn't the best alternative.
</p>
<blockquote>
After my talk during <a href="http://confoo.ca/en">ConFoo</a> on <A href="http://confoo.ca/en/2010/session/advanced-date-time-handling-with-php">Advanced Date/Time Handling</a> 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 would be enough to store an accurate date/time in a database.
</blockquote>
<p>
He mentions the main issue with the UTC-offset method - time changes like Daylight Saving throwing a wrench into the works and how adding/subtracting hours doesn't always work as expected. His suggestion is to store the actual DateTime object information representing the location in question, the timezone identifier and the date/time information as strings. Then, when you need to calculate the date information on the other side, you can recreate it with a DateTime and DateTimeZone objects.
</p>]]></description>
      <pubDate>Tue, 30 Mar 2010 09:16:14 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Derick Rethans' Blog: Unix Epoch and PHP's calendar system]]></title>
      <guid>http://www.phpdeveloper.org/news/13524</guid>
      <link>http://www.phpdeveloper.org/news/13524</link>
      <description><![CDATA[<p>
Based on <a href="http://news.php.net/php.doc.cvs/5325">a fix</a> for a <a href="http://bugs.php.net/bug.php?edit=1&id=50155">recent bug</a>, <i>Derick Rethans</i> wanted to <a href="http://derickrethans.nl/unix_epoch_and_phps_calendar_system.php">clear up something</a> about the Unix Epoc's definition and how it relates to the UTC time zone.
</p>
<blockquote>
While right 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 <a href="http://dictionary.reference.com/browse/proleptic">proleptic</a> Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds." (from Wikipedia).
</blockquote>
<p>
He talks about <a href="http://en.wikipedia.org/wiki/ISO_8601#Years">the calendar PHP uses internally</a> and how dates predating it's use don't make much sense either (as well as the modified version PHP uses that includes "year zero").
</p>]]></description>
      <pubDate>Thu, 12 Nov 2009 10:44:51 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Derick Rethans' Blog: Leap Seconds and What To Do With Them]]></title>
      <guid>http://www.phpdeveloper.org/news/11658</guid>
      <link>http://www.phpdeveloper.org/news/11658</link>
      <description><![CDATA[<p>
<i>Derick Rethans</i> one of the go-to guys for working with time in PHP has made <A href="http://derickrethans.nl/leap_seconds_and_what_to_do_with_them.php">this new post</a> about something 2008 picked up along the way to 2009 - a leap second.
</p>
<blockquote>
The start of this new year started with some buzz about a leap second being introduced between Dec 31st 2008, 23:59:59 and Jan 1st 2009, 00:00:00. I've had people ask where this <a href="http://en.wikipedia.org/wiki/Leap_second">leap second</a> 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. 
</blockquote>
<p>
He ponints out one of the major problems - how time is kept. With variants of Universal Time, it makes it hard to track down what's "right". He breaks out the difference between other time storage methods and the unix time that PHP can use (that counts the number of seconds since Jan 1st 1970) and how the leap second was handled for each.
</p>]]></description>
      <pubDate>Thu, 01 Jan 2009 20:56:35 -0600</pubDate>
    </item>
  </channel>
</rss>
