<?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>Tue, 21 May 2013 18:29:05 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPMaster.com: Working with Dates and Times in PHP and MySQL]]></title>
      <guid>http://www.phpdeveloper.org/news/17608</guid>
      <link>http://www.phpdeveloper.org/news/17608</link>
      <description><![CDATA[<p>
On PHPMaster.com today there's a new tutorial by <i>Sean Hudgston</i> about <a href="http://phpmaster.com/working-with-dates-and-times">working with dates and times</a> via the PHP date functions and how they cooperate with dates/times from a MySQL database.
</p>
<blockquote>
When working in any programming language, dealing with dates and time is often a trivial and simple task. That is, until time zones have to be supported. Fortunately, PHP has one of the most potent set of date/time tools that help you deal with all sorts of time-related issues: Unix timestamps, formatting dates for human consumption, displaying times with time zones, the difference between now and the second Tuesday of next month, etc. In this article I'll introduce you to the basics of PHP's time functions (time(), mktime(), and date()) and their object-oriented counterparts, and then take a look at MySQL dates and show you how to make them play nicely with PHP.
</blockquote>
<p>
His examples include how to get the current Unix time, formatting dates/times, making timestamps and working with the more powerful DateTime objects. On the MySQL front, he shows the result of a normal date select, one using the "unix_timestamp" function and how to shift the result based on the user's timezone.
</p>]]></description>
      <pubDate>Thu, 01 Mar 2012 08:51:47 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Brian Swan's Blog: Sorting Azure Table Entities by Timestamp with PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/16258</guid>
      <link>http://www.phpdeveloper.org/news/16258</link>
      <description><![CDATA[<p>
<i>Brian Swan</i> has a quick new post to his blog for the PHP + Azure users out there on how to easily <a href="http://blogs.msdn.com/b/brian_swan/archive/2011/04/26/sorting-azure-table-entities-by-timestamp-with-php.aspx">sort table entities by a timestamp</a> through the <a href="http://phpazure.codeplex.com/">Azure SDK for PHP</a>. The timestamp is a property on the parent storage table class, so you don't need to create it in your entity, it's already there.
</p>
<blockquote>
The problem boils down to sorting an array of objects by a timestamp property, so the information here is nothing that hasn't been done before. However, after spending some time looking for a way to use a filter in the Windows Azure SDK for PHP API, I didn't find one, so I'm hoping this post might save others some time. In the end, my solution simply uses the PHP <a href="http://us2.php.net/array_multisort">array_multisort</a> function.
</blockquote>
<p>
Sample code is included - a basic class extending Microsoft_WindowsAzure_Storage_TableEntity, a fetch for the entity set of the contacts and using a custom "objSort" method that sorts based on the returned timestamp values from the object set.
</p>]]></description>
      <pubDate>Wed, 27 Apr 2011 10:48:17 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Pumka.net: Why MySQL timestamp is 24 seconds different from PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/15336</guid>
      <link>http://www.phpdeveloper.org/news/15336</link>
      <description><![CDATA[<p>
On the Pumka.net blog, <i>Anton Oliink</i> has <a href="http://blog.pumka.net/2010/10/24/why-mysql-timestamp-is-24-seconds-different-from-php/">an interesting problem</a> where his timestamp on the PHP side of his application was different than the one on his MySQL backend's side - by 24 seconds, in fact.
</p>
<blockquote>
You may find that timestamp value returned by MySQL UNIX_TIMESTAMP() function is 24 seconds grater than those returned by PHP functions and classes like strtotime(), mktime, DateTime::getTimestamp(), Zend_Date::getTimestamp().
</blockquote>
<p>
As it turns out, the issue isn't' really an "issue" after all - it's caused by MySQL's compensation for <a href="http://en.wikipedia.org/wiki/Leap_second">leap seconds</a>. He gives a few ways you can avoid it being an issue in your application, though: disable leap seconds, only convert to timestamps on the PHP side or just use the "unix_timestamp()" and "from_unixtime()" methods to work with the values.
</p>]]></description>
      <pubDate>Tue, 26 Oct 2010 11:24:31 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Zend Developer Zone: Zend_Log timestamp filter ]]></title>
      <guid>http://www.phpdeveloper.org/news/14813</guid>
      <link>http://www.phpdeveloper.org/news/14813</link>
      <description><![CDATA[<p>
On the Zend Developer Zone there's a recent post about a custom filter that's been developed to help <a href="http://devzone.zend.com/article/12318-Zend_Log-timestamp-filter-">filter events based on time</a> instead of just logging them as a whole.
</p>
<blockquote>
For one of my recent project, which is using <a href="http://framework.zend.com/manual/en/zend.log.html">Zend_Log</a> component of the Zend Framework, I had a demand in which I needed to be able to filter log events based on the time they occurred. As out of the box, Zend_Log component does not have such filter, I decided to create one that will fulfill my demands.
</blockquote>
<p>
The log filter, NP_Log_Filter_Timestamp, it allows you to set rules for things like hour, minute year, day of the week, etc. and can be used anywhere you'd create a normal Zend_Log instance. Pass it in the format you'd like to use (that <a href="http://php.net/idate">idate</a> can use), a value to evaluate and a comparison operator. Two code snippets show how it's used.
</p>]]></description>
      <pubDate>Mon, 19 Jul 2010 12:24:48 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[ZendCasts.com: Logging with Timestamps and Doctrine Event Listeners]]></title>
      <guid>http://www.phpdeveloper.org/news/14048</guid>
      <link>http://www.phpdeveloper.org/news/14048</link>
      <description><![CDATA[<p>
The ZendCasts.com site has recently posted a quick video covering <a href="http://www.zendcasts.com/logging-with-timestamps-and-doctrine-event-listeners/2010/02/">logging and Doctrine event listeners</a> in a Zend Framework application.
</p>
<blockquote>
This short video is going to be the last in my 2009-2010 series on Doctrine 1.2. I'm wrapping it up with a little example of adding timestamps, logging and using Doctrine's event listener architecture.
</blockquote>
<p>
The tutorial shows you how to pull in the features of <a href="www.doctrine-project.org">Doctrine</a> to make it easier to create a more complex logging system. He shows how to set up the schema file, add in controller functionality and backend models to make things all work together happily. You can get a copy of the project he's building from <a href="http://zendcasts.googlecode.com/svn/trunk/zc46-adding-logging-and-timestamps-doctrine/zc46-doctrine-event-listeners.zip">his subversion repository</a>.
</p>]]></description>
      <pubDate>Thu, 18 Feb 2010 08:16:43 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Logging in PHP Applications ]]></title>
      <guid>http://www.phpdeveloper.org/news/11529</guid>
      <link>http://www.phpdeveloper.org/news/11529</link>
      <description><![CDATA[<p>
DevShed has posted a <a href="http://www.devshed.com/c/a/PHP/Logging-in-PHP-Applications/">new tutorial</a> today looking at one of the more useful tools a developer can add into an application - logging.
</p>
<blockquote>
If there is no logging mechanism, then if there's a goof-up in a production environment, you have absolutely no idea what went wrong. The only thing which a support developer can do in this case is to reproduce the issue at the developer end, which sometimes work and sometimes don't. 
</blockquote>
<p>
The look at the types of logging (trace logs, audit logs and user logging/history) and create a simple class that allows flexibility for file location, priority and timstamping. Their script contains a writelog method that does all the work (including pushing it through the PEAR logging class).
</p>]]></description>
      <pubDate>Mon, 08 Dec 2008 13:52:10 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[ThinkPHP Blog: Put out the age of a date in words]]></title>
      <guid>http://www.phpdeveloper.org/news/9957</guid>
      <link>http://www.phpdeveloper.org/news/9957</link>
      <description><![CDATA[<p>
On the ThinkPHP blog today, <i>Annika Rabea</i> <a href="http://blog.thinkphp.de/archives/317-Put-out-the-age-of-a-date-in-words.html">shares a method</a> for outputting dates in words rather than in the usual numbers most applications use.
</p>
<blockquote>
Recently, I have to output the age of a date in words and didn't have a framework to work with. The first steps were to parse the given date into an array and create a timestamp with the individual parts. The difference between the timestamp of now and the created timestamp yielded the age in seconds. The result can be used to compare with seconds of a day, week, etc. 
</blockquote>
<p>
The code snippet <a href="http://blog.thinkphp.de/archives/317-Put-out-the-age-of-a-date-in-words.html">in the post</a> outputs the difference between two timestamps (then and now) it a bit more friendly way (ex. 4 months, 2 weeks, 2 days).
</p>]]></description>
      <pubDate>Fri, 11 Apr 2008 10:37:53 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Developer Tutorials Blog: Calculating date difference more precisely in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/9774</guid>
      <link>http://www.phpdeveloper.org/news/9774</link>
      <description><![CDATA[<p>
<i>Hasin Hayder</i> has posted <a href="http://www.developertutorials.com/blog/php/calculating-date-difference-more-precisely-in-php-71/">his own response</a> to a recent "relative time" article (showing users things like "received 2 days and 3 hours ago") with a more precise method for doing something similar:
</p>
<blockquote>
This function is production ready and you can use it in any of your application which mainly works with these date difference. I have found it somewhere in web, just forgot the source. Thanks to the unknown author of this excellent function.
</blockquote>
<p>
The rest of <a href="http://www.developertutorials.com/blog/php/calculating-date-difference-more-precisely-in-php-71/">the post</a> is the function itself that takes in the interval string (formatting), the start date, end date and whether to use timestamps or not.
</p>]]></description>
      <pubDate>Tue, 11 Mar 2008 08:40:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Photogapple.co.uk: time_since]]></title>
      <guid>http://www.phpdeveloper.org/news/7670</guid>
      <link>http://www.phpdeveloper.org/news/7670</link>
      <description><![CDATA[<p>
On the Photogapple.co.uk blog today, there's <a href="http://www.photogabble.co.uk/2007/04/20/time_since/">some handy code</a> that can definitely be useful when working with dates in PHP - a function to find the difference between the current time and a timestamp you give it.
</p>
<blockquote>
I found it incredibly difficult to find any form of time_since function in php so to save anyone else the trouble to hunting through hundreds of useless websites here is the function you may want to use, written by <a href="http://notes.natbat.net/2007/01/27/timesince/">Natalie Downe</a> (you don't want to know how long it took to hunt it down).
</blockquote>
<p>
The function takes in the value, subtracts the two timestamps and loops through an array of "time chunks" to each other to show nicely formatted output of how long the difference it.
</p>]]></description>
      <pubDate>Fri, 20 Apr 2007 11:07:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[JSLabs Blog:  How to stop IE from caching AJAX requests]]></title>
      <guid>http://www.phpdeveloper.org/news/7217</guid>
      <link>http://www.phpdeveloper.org/news/7217</link>
      <description><![CDATA[<p>
If you've ever had the frustration of working with Ajax in Internet Explorer and have noticed it caching the requests/results, you might want to check out <a href="http://www.whenpenguinsattack.com/2007/02/05/how-to-stop-ie-from-caching-ajax-requests/">this new post</a> on the JSLabs blog for a helpful hint.
</p>
<blockquote>
While working on an AJAX project over the weekend, I ran into the following issue: (through a GET request), every time I tried to call a certain function, It was returning the same data (which was supposed to be different each time)
</blockquote>
<p>
First, he tried just changing the headers (via PHP's header function) to see if IE would understand the new message, but to no avail. He finally figured out that, despite whatever headers were sent or how much the content changed, what he really needed to do was to provide the script some kind of unique identifier with each request (just appended to the url) so that IE knew the request was different. His weapon of choice was a date/time value.
</p>]]></description>
      <pubDate>Mon, 05 Feb 2007 08:05:00 -0600</pubDate>
    </item>
  </channel>
</rss>
