<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PHP Software Developing &#187; Dates</title>
	<atom:link href="http://www.phpdeveloping.co.za/category/dates/feed" rel="self" type="application/rss+xml" />
	<link>http://www.phpdeveloping.co.za</link>
	<description>for the love of PHP Development</description>
	<lastBuildDate>Tue, 29 Sep 2009 15:38:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Date and Strtotime Coolness</title>
		<link>http://www.phpdeveloping.co.za/dates/date-and-strtotime-coolness.html</link>
		<comments>http://www.phpdeveloping.co.za/dates/date-and-strtotime-coolness.html#comments</comments>
		<pubDate>Fri, 04 Sep 2009 12:44:14 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Dates]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[strtotime]]></category>

		<guid isPermaLink="false">http://www.phpdeveloping.co.za/?p=133</guid>
		<description><![CDATA[Two very useful functions in PHP is strtotime and date.  It can be cumbersome to make use of these 2 though, so I got a little function that makes it so much easier.

function odate&#40;$format, $criteria&#41;&#123;
  return &#40;date&#40;$format&#41;, strtotime&#40;$criteria, strtotime&#40;$format&#41;&#41;&#41;;
&#125;

Now all you do is call it like :

echo odate&#40;&#34;Y-m-d H:i:s&#34;, &#34;+1 days&#34;&#41;; // 1 [...]]]></description>
			<content:encoded><![CDATA[<p>Two very useful functions in PHP is strtotime and date.  It can be cumbersome to make use of these 2 though, so I got a little function that makes it so much easier.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> odate<span style="color: #009900;">&#40;</span><span style="color: #000088;">$format</span><span style="color: #339933;">,</span> <span style="color: #000088;">$criteria</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$format</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$criteria</span><span style="color: #339933;">,</span> <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$format</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Now all you do is call it like :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> odate<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Y-m-d H:i:s&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;+1 days&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 1 day ahead of today</span>
<span style="color: #b1b100;">echo</span> odate<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Y-m-d H:i:s&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;-7 days&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//  7 days ago</span>
<span style="color: #b1b100;">echo</span> odate<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Y-m-d H:i:s&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;+1 hours&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 1 hours from now</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.phpdeveloping.co.za/dates/date-and-strtotime-coolness.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
