<?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>Sat, 25 May 2013 16:14:11 -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[Stephen Colebourne's Blog: Time-zone database down]]></title>
      <guid>http://www.phpdeveloper.org/news/16967</guid>
      <link>http://www.phpdeveloper.org/news/16967</link>
      <description><![CDATA[<p>
In a new post to <i>Stephen Colebourne</i>'s blog today, there's some bad news for developers of software and OSes in general - the timezone database that most software uses <a href="http://blog.joda.org/2011/10/today-time-zone-database-was-closed.html?m=1">is down due to a copyright struggle</a> with a company named <a href="http://alabe.com/">Astrolabe, Inc.</a>. How does this relate to PHP? It's the same database the language uses to define its timezones as a part of the <a href="http://php.net/datetime">DateTime</a> functionality.
</p>
<blockquote>
The <a href="http://en.wikipedia.org/wiki/Tz_database">time-zone database</a> (sometimes referred to as the Olson database) is the computing world's principle source of time-zone data. It is embedded in every Unix and Java for starters, and will be used by many websites and probably by your iPhone. You may know it via the IDs, such as "Europe/London" or "America/New_York". But, perhaps you're thinking that time-zones don't change? Well that may be true for America and the EU right now, but certainly isn't for the rest of the world. 
</blockquote>
<p>
Astrolabe claims that the database is a part of the work on their "ACS Atlas" product and the contents of it belong to them. 
</p>
<blockquote>
The impact of this is severe for anyone that uses it - whether via Java, Unix or some other means. This really is the key tool used by everyone to tell the right time globally. We all owe a debt of gratitude to the database maintainers who have worked on this for many, many years at zero cost to the industry and for zero financial gain.
</blockquote>
<p>
<i>Stephen</i> <a href="http://blog.joda.org/2011/10/today-time-zone-database-was-closed.html?m=1">puts out a call</a> to some of the larger technology leaders/companies to help resolve this situation and/or provide a resource where this information can once again be accessed freely.
</p>]]></description>
      <pubDate>Fri, 07 Oct 2011 12:48:02 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Christian Schaefer's Blog: Beware of the timezone! Working with PHP DateTime & Doctrine for MongoDB]]></title>
      <guid>http://www.phpdeveloper.org/news/16822</guid>
      <link>http://www.phpdeveloper.org/news/16822</link>
      <description><![CDATA[<p>
<i>Christian Schaefer</i> has a recent post pointing out a common frustration among developers of applications with NoSQL backends, specifically with Doctrine, MongoDB and PHP DateTime objects - <a href="http://test.ical.ly/2011/09/01/beware-of-the-timezone-working-with-php-datetime-and-doctrine-for-mongodb-can-cause-conflicts/">timezone conflicts</a>.
</p>
<blockquote>
I really like <a href="http://test.ical.ly/2011/03/25/how-to-select-for-a-specific-date-or-time-with-doctrine-2-0/">Doctrines way of dealing with dates and times</a>. Instead of passing timestamps around or strings with ISO date format it simply makes use of the PHP native type DateTime which provides all you really need to work with. PHPs interface to MongoDB however comes with its own MongoDate type which provides hardly any functionality compared to DateTime and it's not compatible with it. So what's the difference?
</blockquote>
<p>
In some of the <a href="http://test.ical.ly/2011/09/01/beware-of-the-timezone-working-with-php-datetime-and-doctrine-for-mongodb-can-cause-conflicts/#comments">comments to the post</a>, readers mention that the problem is bigger than just the tools used to work with the database, it's that databases usually don't care about timezones when working with date/time. There's also an interesting mention further down about <a href="http://www.lightcubesolutions.com/blog/?p=373">the timezone support MongoDB does have</a> and an example snippet ofo code that uses the support.
</p>]]></description>
      <pubDate>Tue, 06 Sep 2011 13:50:38 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[James Cohen's Blog: Working with Date and Time in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/16292</guid>
      <link>http://www.phpdeveloper.org/news/16292</link>
      <description><![CDATA[<p>
<i>James Cohen</i> has <a href="http://webmonkeyuk.wordpress.com/2011/05/04/working-with-date-and-time-in-php/">a new post to his blog</a> today looking at some of the built-in functionality that PHP has to work with dates and times including simple things like <a href="http://php.net/strtotime">strtotime</a> and the <a href="http://php.net/datetime">DateTime</a> feature.
</p>
<blockquote>
A lot of people ask questions relating to date and time in PHP. Here are some answers to the most commonly asked questions and common mistakes.
</blockquote>
<p>
He covers the differences between working with dates in strtotime, worrying about timezone settings and compares the strtotime/DateTime methods for formatting and returning dates, modifying dates, converting between timezones as well as finding the difference between two timezones. 
</p>]]></description>
      <pubDate>Wed, 04 May 2011 08:59:23 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[SitePoint PHP Blog: How To Synchronize Your PHP and MySQL Timezones]]></title>
      <guid>http://www.phpdeveloper.org/news/16224</guid>
      <link>http://www.phpdeveloper.org/news/16224</link>
      <description><![CDATA[<p>
In a new post to the SitePoint PHP blog today <i>Craig Buckler</i> looks at a method for <a href="http://blogs.sitepoint.com/synchronize-php-mysql-timezone-configuration/">synchronizing your time between your PHP application and it's MySQL backend</a> to make date handling a bit easier - no messy code-based timezone changes needed.
</p>
<blockquote>
Many developers solve the problem by shifting all date/time responsibility to PHP. They may also convert dates to Unix timestamp integers for simpler handling, although you should be wary of the <a href="http://blogs.sitepoint.com/is-your-php-application-affected-by-the-y2k38-bug">Y2K38 Bug</a>.
</blockquote>
<p>
They show a handy tip so you won't have to worry quite so much that relies on setting a "TIMEZONE" constant you can use to <a href="http://php.net/date_default_timezone_set">set the default timezone</a> and a "time_zone" offset that can be used each time you make the connection to your database (or, alternatively, in a cron that keeps things up to date without interfering with performance).
</p>]]></description>
      <pubDate>Wed, 20 Apr 2011 11:52:50 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Ibuildings techPortal: Tips for Working with DateTime in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/14459</guid>
      <link>http://www.phpdeveloper.org/news/14459</link>
      <description><![CDATA[<p>
In the latest post from the Ibuildings techPortal <i>Lorna Mitchell</i> <a href="http://techportal.ibuildings.com/2010/04/29/tips-for-working-with-datetime-in-php/">takes a look at</a> one of the more powerful features included in PHP versions 5.2 and greater - the DateTime class.
</p>
<blockquote>
In the newer PHP 5.3 versions even more excellent functionality was added. This is a short post to introduce this functionality with a focus on the methods available in PHP 5.2 showing some simple examples of how we can more easily manipulate and display dates without needing to work with timestamps.
</blockquote>
<p>
She shows how to create a simple DateTime object, how to change up the timezone information related to it and has an example of how to output the format with a call to <a href="http://www.php.net/manual/en/datetime.format.php">the format function</a>. She also mentions how they can simplify the storage of date information in a database since they can be moved around between timezones easily (instead of having to calculate the different between where it was created and where it's being used).
</p>]]></description>
      <pubDate>Tue, 04 May 2010 13:33:29 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Zend Framework By Examples: Handling dates and times (Zend_Date)]]></title>
      <guid>http://www.phpdeveloper.org/news/13893</guid>
      <link>http://www.phpdeveloper.org/news/13893</link>
      <description><![CDATA[<p>
The Zend Framework By Examples site has <a href="http://zend-framework-examples.blogspot.com/2009/12/date.html">posted a recent tutorial</a> about using the Zend_Date component of the Zend Framework to work with dates and times in your PHP applications.
</p>
<blockquote>
In this example, we get or set dates in different timezones. We display parts of dates and times in various formats. We also get information on sunrise and sunset in several locations.
</blockquote>
<p>
They also incorporate other components in the examples including Zend_Cache, Zend_Locate and Zend_Registry. Their examples show how to check the locale, verify the timezone and figure out a "date from now". Complete code is included - it's not the best method to handle some parts of the example, but it's a rough guide in the right direction.
</p>]]></description>
      <pubDate>Fri, 22 Jan 2010 11:09:45 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Vancouver Web Consultants Blog: Getting Time Zone from Latitude & Longitude]]></title>
      <guid>http://www.phpdeveloper.org/news/12483</guid>
      <link>http://www.phpdeveloper.org/news/12483</link>
      <description><![CDATA[<p>
On the Vancouver Web Consultants blog there's <a href="http://vancouverwebconsultants.com/getting-time-zone-from-latitude-longitude/">this new tutorial</a> about grabbing latitude and longitude information for a location and determining its current time zone from there.
</p>
<blockquote>
I was recently tasked with building an application that relied heavily on accurate time zone conversions. I, like many people I soon found out, thought there were just a handful of timezones and the usual select list would suffice. The deeper I looked into the problem, the deeper it got: the list above only shows a few time offsets from UTC, but it doesn't tell me, beyond a shadow of a doubt, exactly what time it is where the user is situated, nor can I rely on that time for calculations in the future. The fact is, here are a LOT of timezones in the world.
</blockquote>
<p>
He came across the <a href="http://us2.php.net/datetimezone">DateTimeZone class</a> PHP has to offer and was happy to see it met his needs. Unfortunately, users weren't always sure what timezone they were in, so he came up with a system combining <a href="http://code.google.com/apis/maps/">Google's Maps API</a> and <a href="http://www.geonames.org/export/web-services.html">GeoNames.org</a>. He includes the code for both the PHP and Javascript sides (the Javascript requires Mootools, but it could be easily adapted to any other Javascript libraries).
</p>]]></description>
      <pubDate>Fri, 08 May 2009 11:15:30 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Terry Chay's Blog: How much does a date() cost?]]></title>
      <guid>http://www.phpdeveloper.org/news/12476</guid>
      <link>http://www.phpdeveloper.org/news/12476</link>
      <description><![CDATA[<p>
In <a href="http://terrychay.com/blog/article/benchmarking-date-timezone.shtml">a new post</a> to his blog <i>Terry Chay</i> looks at the real cost of a (call to) <a href="http://php.net/date">date()</a> - the PHP function that can parse either the current or an inputted timestamp out into the date format you specify.
</p>
<blockquote>
One of the fringe benefits of open sources an existing code base is that you have an opportunity to setting error_reporting on E_ALL | E_STRICT or perhaps rather just to 2147483647. When you do that you find small problems with your code base you missed the first time you sloppily wrote it. In my case, I noticed that date() was throwing strict errors. 
</blockquote>
<p>
Due to his resulting request to test the error (after submitting a ticket to fix the server's php.ini settings), he went about trying to test and see what the real impact of working with the date function was by developing his own simple benchmarking script. It runs through five different tests some with a default timezone set and some not. His results found that doing it in the script versus on the server's config didn't make much of a difference so he corrected the issue with a quick <a href="http://php.net/ini_set">ini_set</a> (or a <a href="http://php.net/date_default_timezone_set">date_default_timezone_set</a>).
</p>]]></description>
      <pubDate>Thu, 07 May 2009 11:18:28 -0500</pubDate>
    </item>
  </channel>
</rss>
