<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
	>
<channel>
	<title>Comments on: Helpful strtotime reminders</title>
	<atom:link href="http://www.102degrees.com/blog/2007/07/11/helpful-strtotime-reminders/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.102degrees.com/blog/2007/07/11/helpful-strtotime-reminders/</link>
	<description>Web Programming and Design by Aaron Saray</description>
	<pubDate>Tue, 06 Jan 2009 04:37:56 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Todd</title>
		<link>http://www.102degrees.com/blog/2007/07/11/helpful-strtotime-reminders/comment-page-1/#comment-702</link>
		<dc:creator>Todd</dc:creator>
		<pubDate>Thu, 12 Jun 2008 22:16:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.102degrees.com/blog/2007/07/11/helpful-strtotime-reminders/#comment-702</guid>
		<description>&#62;&#62; Finally, the plain year came out as that year’s version of
&#62;&#62; today’s date - which is kind of helpful (in case you wanted
&#62;&#62; to know what day july 11th was back in 1999).

Be careful when using strtotime with numbers only!  gnu wants to interpret number only formats differently and a four-digit number is assumed to be hhmm.  Since 1999 is not a valid time (19:99) it must automatically fallback to assuming it is a year, but 2000 is 8:00 p.m. of the current date, watch what happens!

print "date('r', strtotime('1999'))";
print date('r', strtotime('1999')) . "\n";
print "date('r', strtotime('2000'))";
print date('r', strtotime('2000')) . "\n";
print "date('r', strtotime('2230'))";
print date('r', strtotime('2230')) . "\n";

Prints:

date('r', strtotime('1999'))Sat, 12 Jun 1999 21:36:27 +0000
date('r', strtotime('2000'))Thu, 12 Jun 2008 20:00:00 +0000
date('r', strtotime('2230'))Thu, 12 Jun 2008 22:30:00 +0000

Note that the date for the last two entries are for 2008, not the years 2000 and 2230, respectively.  However, the time is 20:00 and 22:30, respectively.  So, the strtotime library views a 4-digit number differently!</description>
		<content:encoded><![CDATA[<p>&gt;&gt; Finally, the plain year came out as that year’s version of<br />
&gt;&gt; today’s date - which is kind of helpful (in case you wanted<br />
&gt;&gt; to know what day july 11th was back in 1999).</p>
<p>Be careful when using strtotime with numbers only!  gnu wants to interpret number only formats differently and a four-digit number is assumed to be hhmm.  Since 1999 is not a valid time (19:99) it must automatically fallback to assuming it is a year, but 2000 is 8:00 p.m. of the current date, watch what happens!</p>
<p>print &#8220;date(&#8217;r', strtotime(&#8217;1999&#8242;))&#8221;;<br />
print date(&#8217;r', strtotime(&#8217;1999&#8242;)) . &#8220;\n&#8221;;<br />
print &#8220;date(&#8217;r', strtotime(&#8217;2000&#8242;))&#8221;;<br />
print date(&#8217;r', strtotime(&#8217;2000&#8242;)) . &#8220;\n&#8221;;<br />
print &#8220;date(&#8217;r', strtotime(&#8217;2230&#8242;))&#8221;;<br />
print date(&#8217;r', strtotime(&#8217;2230&#8242;)) . &#8220;\n&#8221;;</p>
<p>Prints:</p>
<p>date(&#8217;r', strtotime(&#8217;1999&#8242;))Sat, 12 Jun 1999 21:36:27 +0000<br />
date(&#8217;r', strtotime(&#8217;2000&#8242;))Thu, 12 Jun 2008 20:00:00 +0000<br />
date(&#8217;r', strtotime(&#8217;2230&#8242;))Thu, 12 Jun 2008 22:30:00 +0000</p>
<p>Note that the date for the last two entries are for 2008, not the years 2000 and 2230, respectively.  However, the time is 20:00 and 22:30, respectively.  So, the strtotime library views a 4-digit number differently!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.013 seconds -->
