<?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>jtGraphic: James Thompson &#187; date</title>
	<atom:link href="http://www.jtgraphic.net/tag/date/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jtgraphic.net</link>
	<description>I can help you get where you want to go on the Internet.  We&#039;ll have fun along the way too.</description>
	<lastBuildDate>Mon, 26 Jul 2010 12:00:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Scheduling Posts in WordPress 2.9.x</title>
		<link>http://www.jtgraphic.net/2010/02/scheduling-posts-wordpress-29x/</link>
		<comments>http://www.jtgraphic.net/2010/02/scheduling-posts-wordpress-29x/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 17:00:26 +0000</pubDate>
		<dc:creator>James Thompson</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[future]]></category>
		<category><![CDATA[past]]></category>
		<category><![CDATA[posts]]></category>
		<category><![CDATA[schedule]]></category>
		<category><![CDATA[Vacation]]></category>

		<guid isPermaLink="false">http://www.jtgraphic.net/?p=564</guid>
		<description><![CDATA[
			
				
			
		
<p class="wp-caption-text">The expanded Publish Date field.</p>
<p>The easiest way to release content on your blog is to write it all at once and slow release it over time.  This also works really well when you&#8217;re on vacation or otherwise indisposed.</p>

Write your post like you normally would, but hitting the &#8220;New Post&#8221; button in the top right corner <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.jtgraphic.net/2010/02/scheduling-posts-wordpress-29x/">Scheduling Posts in WordPress 2.9.x</a></span><p><a href="http://www.jtgraphic.net/2010/02/scheduling-posts-wordpress-29x/">Scheduling Posts in WordPress 2.9.x</a> is a post from: <a href="http://www.jtgraphic.net">jtGraphic: James Thompson</a></p>
]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.jtgraphic.net%2F2010%2F02%2Fscheduling-posts-wordpress-29x%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.jtgraphic.net%2F2010%2F02%2Fscheduling-posts-wordpress-29x%2F&amp;source=jtgraphic&amp;style=normal&amp;service=bit.ly&amp;hashtags=Blogging,date,future,past,posts,schedule,Tutorials,Vacation" height="61" width="50" /><br />
			</a>
		</div>
<div id="attachment_565" class="wp-caption alignright" style="width: 300px"><a href="http://www.jtgraphic.net/wp-content/Picture-17.png"><img class="size-full wp-image-565" title="Picture 17" src="http://www.jtgraphic.net/wp-content/Picture-17.png" alt="" width="290" height="274" /></a><p class="wp-caption-text">The expanded Publish Date field.</p></div>
<p>The easiest way to release content on your blog is to write it all at once and slow release it over time.  This also works really well when you&#8217;re on vacation or otherwise indisposed.</p>
<ol>
<li>Write your post like you normally would, but hitting the &#8220;New Post&#8221; button in the top right corner of your dashboard.</li>
<li>Look on the right side of your post window and you should see some publish options.  Click &#8220;Edit&#8221; where it says Publish immediately.</li>
<li>The window should expand and look something like the image to the right.</li>
<li>Set your date and hit &#8220;OK&#8221; and it will release in the future.</li>
</ol>
<p>If you use this on all of your posts, you can dedicate specific large amounts of time to setting up your posts for the week or month.  This way you can have periods of inactivity on your blog and still be releasing content.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li style="clear: both;"><a href="http://www.jtgraphic.net/2010/03/build-content-blog/" rel="bookmark"><img width="50" height="50" src="http://www.jtgraphic.net/wp-content/trash-can-150x150.jpg" class="crp_thumb wp-post-image" alt="How to Build Content for a New Blog" title="How to Build Content for a New Blog" border="0" /></a> <a href="http://www.jtgraphic.net/2010/03/build-content-blog/" rel="bookmark" class="crp_title">How to Build Content for a New Blog</a><span class="crp_excerpt"> <div id="attachment_600" class="wp-caption alignright" style="width: 310px"><p class="wp-caption-text">Don&#39;t waste your time. Have a plan.</p></div>[/caption]

Building content for a new blog can be extremely formulaic.  ...</span></li><li style="clear: both;"><a href="http://www.jtgraphic.net/2010/07/series-52-weeks-successful-blog-week-1/" rel="bookmark"><img width="50" height="20" src="http://www.jtgraphic.net/wp-content/Picture-8-300x122.png" class="crp_thumb wp-post-image" alt="Series: 52 Weeks to a Successful Blog: Week 1" title="Series: 52 Weeks to a Successful Blog: Week 1" border="0" /></a> <a href="http://www.jtgraphic.net/2010/07/series-52-weeks-successful-blog-week-1/" rel="bookmark" class="crp_title">Series: 52 Weeks to a Successful Blog: Week 1</a><span class="crp_excerpt"> I'm starting a new blog series called 52 Weeks to Success.  It's going to be about starting a blog and ...</span></li><li style="clear: both;"><a href="http://www.jtgraphic.net/2009/07/google-analytics-highlight-weekends/" rel="bookmark"><img width="50" height="8" src="http://www.jtgraphic.net/wp-content/Picture-9-300x49.jpg" class="crp_thumb wp-post-image" alt="Why can&#8217;t Google Analytics highlight weekends?" title="Why can&#8217;t Google Analytics highlight weekends?" border="0" /></a> <a href="http://www.jtgraphic.net/2009/07/google-analytics-highlight-weekends/" rel="bookmark" class="crp_title">Why can&#8217;t Google Analytics highlight weekends?</a><span class="crp_excerpt"> Wouldn't it be cool if you could highlight weekends in Google Analytics?  I could be missing something and it's possible, ...</span></li></ul></div><p><a href="http://www.jtgraphic.net/2010/02/scheduling-posts-wordpress-29x/">Scheduling Posts in WordPress 2.9.x</a> is a post from: <a href="http://www.jtgraphic.net">jtGraphic: James Thompson</a></p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.jtgraphic.net%2F2010%2F02%2Fscheduling-posts-wordpress-29x%2F&amp;title=Scheduling%20Posts%20in%20Wordpress%202.9.x&amp;bodytext=%0D%0A%0D%0AThe%20easiest%20way%20to%20release%20content%20on%20your%20blog%20is%20to%20write%20it%20all%20at%20once%20and%20slow%20release%20it%20over%20time.%C2%A0%20This%20also%20works%20really%20well%20when%20you%27re%20on%20vacation%20or%20otherwise%20indisposed.%0D%0A%0D%0A%09Write%20your%20post%20like%20you%20normally%20would%2C%20but%20hitting%20the%20" title="Digg"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.jtgraphic.net%2F2010%2F02%2Fscheduling-posts-wordpress-29x%2F&amp;title=Scheduling%20Posts%20in%20Wordpress%202.9.x&amp;notes=%0D%0A%0D%0AThe%20easiest%20way%20to%20release%20content%20on%20your%20blog%20is%20to%20write%20it%20all%20at%20once%20and%20slow%20release%20it%20over%20time.%C2%A0%20This%20also%20works%20really%20well%20when%20you%27re%20on%20vacation%20or%20otherwise%20indisposed.%0D%0A%0D%0A%09Write%20your%20post%20like%20you%20normally%20would%2C%20but%20hitting%20the%20" title="del.icio.us"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.jtgraphic.net/wp-content/plugins/sociable/awesmate.php?c=facebook-post&t=http%3A%2F%2Fwww.jtgraphic.net%2F2010%2F02%2Fscheduling-posts-wordpress-29x%2F&d=http://www.facebook.com/share.php?u=TARGET%26t=Scheduling%20Posts%20in%20Wordpress%202.9.x" title="Facebook"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.jtgraphic.net%2F2010%2F02%2Fscheduling-posts-wordpress-29x%2F&amp;title=Scheduling%20Posts%20in%20Wordpress%202.9.x" title="Mixx"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.jtgraphic.net%2F2010%2F02%2Fscheduling-posts-wordpress-29x%2F&amp;title=Scheduling%20Posts%20in%20Wordpress%202.9.x&amp;annotation=%0D%0A%0D%0AThe%20easiest%20way%20to%20release%20content%20on%20your%20blog%20is%20to%20write%20it%20all%20at%20once%20and%20slow%20release%20it%20over%20time.%C2%A0%20This%20also%20works%20really%20well%20when%20you%27re%20on%20vacation%20or%20otherwise%20indisposed.%0D%0A%0D%0A%09Write%20your%20post%20like%20you%20normally%20would%2C%20but%20hitting%20the%20" title="Google Bookmarks"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.jtgraphic.net%2F2010%2F02%2Fscheduling-posts-wordpress-29x%2F&amp;title=Scheduling%20Posts%20in%20Wordpress%202.9.x" title="StumbleUpon"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.jtgraphic.net%2F2010%2F02%2Fscheduling-posts-wordpress-29x%2F" title="Technorati"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.jtgraphic.net/wp-content/plugins/sociable/awesmate.php?c=myspace&t=http%3A%2F%2Fwww.jtgraphic.net%2F2010%2F02%2Fscheduling-posts-wordpress-29x%2F&d=http://www.myspace.com/Modules/PostTo/Pages/?u=TARGET%26t=Scheduling%20Posts%20in%20Wordpress%202.9.x" title="MySpace"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.jtgraphic.net/wp-content/plugins/sociable/awesmate.php?c=twitter&t=http%3A%2F%2Fwww.jtgraphic.net%2F2010%2F02%2Fscheduling-posts-wordpress-29x%2F&d=http://twitter.com/home?status=Scheduling%20Posts%20in%20Wordpress%202.9.x%20-%20TARGET" title="Twitter"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" /></a>
	<a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.jtgraphic.net%2F2010%2F02%2Fscheduling-posts-wordpress-29x%2F" title="Sphinn"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.jtgraphic.net%2F2010%2F02%2Fscheduling-posts-wordpress-29x%2F&amp;title=Scheduling%20Posts%20in%20Wordpress%202.9.x" title="Reddit"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.jtgraphic.net/2010/02/scheduling-posts-wordpress-29x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Function Friday: date</title>
		<link>http://www.jtgraphic.net/2009/10/php-function-friday-date/</link>
		<comments>http://www.jtgraphic.net/2009/10/php-function-friday-date/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 04:02:01 +0000</pubDate>
		<dc:creator>James Thompson</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[Function Friday]]></category>

		<guid isPermaLink="false">http://www.jtgraphic.net/?p=445</guid>
		<description><![CDATA[
			
				
			
		
<p>I think the date function is extremely useful.  It gives your programs an awareness of WHEN they are.  You can do some pretty cool things like calculate this date from that date, make a calendar, or store information about when an action was taken.</p>
Function and Syntax
string date(string $format  [, int $timestamp  ])
Manual Entry
<p>http://php.net/manual/en/function.date.php</p>
Notes and <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.jtgraphic.net/2009/10/php-function-friday-date/">PHP Function Friday: date</a></span><p><a href="http://www.jtgraphic.net/2009/10/php-function-friday-date/">PHP Function Friday: date</a> is a post from: <a href="http://www.jtgraphic.net">jtGraphic: James Thompson</a></p>
]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F10%2Fphp-function-friday-date%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F10%2Fphp-function-friday-date%2F&amp;source=jtgraphic&amp;style=normal&amp;service=bit.ly&amp;hashtags=date,Function+Friday" height="61" width="50" /><br />
			</a>
		</div>
<p>I think the date function is extremely useful.  It gives your programs an awareness of WHEN they are.  You can do some pretty cool things like calculate this date from that date, make a calendar, or store information about when an action was taken.</p>
<h3>Function and Syntax</h3>
<pre class="brush: php">string date(string $format  [, int $timestamp  ])</pre>
<h3>Manual Entry</h3>
<p><a href="http://php.net/manual/en/function.date.php" target="_blank">http://php.net/manual/en/function.date.php</a></p>
<h3>Notes and Use</h3>
<p>There are two variables you can pass to the date function: the string format, and the timestamp.  What are those?  The string format uses various characters to define how the string the function returns will be formatted.  The table for which characters mean what is on the <a href="http://php.net/manual/en/function.date.php">PHP Manual Page</a>.  The timestamp is a Unix timestamp for a specific date/time.</p>
<h3>Other Functions Referenced in Examples</h3>
<ul>
<li><a href="http://php.net/manual/en/control-structures.if.php" target="_blank">if<br />
</a></li>
</ul>
<h3>Examples</h3>
<h4>Output Today&#8217;s Date and Time</h4>
<p>This should just simply output today&#8217;s date.  I did a few formats based on January 1, 2009 at 4:52:39 PM.</p>
<pre class="brush: php">echo date("Y-m-d H:i:s"); /* Should output '2009-01-01 16:52:39'.  Common programming format*/
echo date("F n, Y at g:m:s A") /* Should output 'January 1, 2009 at 4:52:39 PM'.*/
</pre>
<h4>Put a Message on Your Website Every Monday</h4>
<p>Do you hate Mondays?  Let everyone know.  This script checks to see if it&#8217;s Monday and then outputs a message if it is.  That &#8216;w&#8217; in the date function is a numeric representation of the day of the week.  For instance: Wednesday is 3 and Sunday is 0.</p>
<pre class="brush: php">if(date("w") == 1) {
   echo "Ugh.  It's Monday."
}
</pre>
<h3>Examples Elsewhere on this Site:</h3>
<p><a href="http://www.jtgraphic.net/2009/10/tidbit-tuesday-php-holiday-notices-business-sites/" target="_blank">Holiday Notices</a></p>
<h3>Conclusion</h3>
<p>Date functions are extremely useful when trying to figure out when you are (or better stated: when your program tries to figure out when it is).  Using date and time functions allow you to create a lot of automation in your scripts.  Have you got any useful implementations on this function?</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li style="clear: both;"><a href="http://www.jtgraphic.net/2009/09/php-function-friday-function/" rel="bookmark"><img src="http://www.jtgraphic.net/wp-content/plugins/contextual-related-posts/default.png" alt="PHP Function Friday: function" title="PHP Function Friday: function" width="50" height="50" border="0" class="crp_thumb" /></a> <a href="http://www.jtgraphic.net/2009/09/php-function-friday-function/" rel="bookmark" class="crp_title">PHP Function Friday: function</a><span class="crp_excerpt"> So, I've decided to start including a new post every Friday - kind of as a discipline thing.  I'm ...</span></li><li style="clear: both;"><a href="http://www.jtgraphic.net/2009/10/tidbit-tuesday-php-holiday-notices-business-sites/" rel="bookmark"><img src="http://www.jtgraphic.net/wp-content/plugins/contextual-related-posts/default.png" alt="Tidbit Tuesday on PHP: Holiday Notices for Business Sites" title="Tidbit Tuesday on PHP: Holiday Notices for Business Sites" width="50" height="50" border="0" class="crp_thumb" /></a> <a href="http://www.jtgraphic.net/2009/10/tidbit-tuesday-php-holiday-notices-business-sites/" rel="bookmark" class="crp_title">Tidbit Tuesday on PHP: Holiday Notices for Business Sites</a><span class="crp_excerpt"> This is a handy script for managing an out of office message on your website.  I find this very useful ...</span></li><li style="clear: both;"><a href="http://www.jtgraphic.net/2009/10/php-function-friday-include/" rel="bookmark"><img src="http://www.jtgraphic.net/wp-content/plugins/contextual-related-posts/default.png" alt="PHP Function Friday: include" title="PHP Function Friday: include" width="50" height="50" border="0" class="crp_thumb" /></a> <a href="http://www.jtgraphic.net/2009/10/php-function-friday-include/" rel="bookmark" class="crp_title">PHP Function Friday: include</a><span class="crp_excerpt"> Including files makes it really easy to NOT duplicate code.  It's great for creating headers and footers for websites, ...</span></li></ul></div><p><a href="http://www.jtgraphic.net/2009/10/php-function-friday-date/">PHP Function Friday: date</a> is a post from: <a href="http://www.jtgraphic.net">jtGraphic: James Thompson</a></p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F10%2Fphp-function-friday-date%2F&amp;title=PHP%20Function%20Friday%3A%20date&amp;bodytext=I%20think%20the%20date%20function%20is%20extremely%20useful.%C2%A0%20It%20gives%20your%20programs%20an%20awareness%20of%20WHEN%20they%20are.%C2%A0%20You%20can%20do%20some%20pretty%20cool%20things%20like%20calculate%20this%20date%20from%20that%20date%2C%20make%20a%20calendar%2C%20or%20store%20information%20about%20when%20an%20action%20was%20taken." title="Digg"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F10%2Fphp-function-friday-date%2F&amp;title=PHP%20Function%20Friday%3A%20date&amp;notes=I%20think%20the%20date%20function%20is%20extremely%20useful.%C2%A0%20It%20gives%20your%20programs%20an%20awareness%20of%20WHEN%20they%20are.%C2%A0%20You%20can%20do%20some%20pretty%20cool%20things%20like%20calculate%20this%20date%20from%20that%20date%2C%20make%20a%20calendar%2C%20or%20store%20information%20about%20when%20an%20action%20was%20taken." title="del.icio.us"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.jtgraphic.net/wp-content/plugins/sociable/awesmate.php?c=facebook-post&t=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F10%2Fphp-function-friday-date%2F&d=http://www.facebook.com/share.php?u=TARGET%26t=PHP%20Function%20Friday%3A%20date" title="Facebook"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F10%2Fphp-function-friday-date%2F&amp;title=PHP%20Function%20Friday%3A%20date" title="Mixx"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F10%2Fphp-function-friday-date%2F&amp;title=PHP%20Function%20Friday%3A%20date&amp;annotation=I%20think%20the%20date%20function%20is%20extremely%20useful.%C2%A0%20It%20gives%20your%20programs%20an%20awareness%20of%20WHEN%20they%20are.%C2%A0%20You%20can%20do%20some%20pretty%20cool%20things%20like%20calculate%20this%20date%20from%20that%20date%2C%20make%20a%20calendar%2C%20or%20store%20information%20about%20when%20an%20action%20was%20taken." title="Google Bookmarks"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F10%2Fphp-function-friday-date%2F&amp;title=PHP%20Function%20Friday%3A%20date" title="StumbleUpon"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F10%2Fphp-function-friday-date%2F" title="Technorati"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.jtgraphic.net/wp-content/plugins/sociable/awesmate.php?c=myspace&t=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F10%2Fphp-function-friday-date%2F&d=http://www.myspace.com/Modules/PostTo/Pages/?u=TARGET%26t=PHP%20Function%20Friday%3A%20date" title="MySpace"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.jtgraphic.net/wp-content/plugins/sociable/awesmate.php?c=twitter&t=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F10%2Fphp-function-friday-date%2F&d=http://twitter.com/home?status=PHP%20Function%20Friday%3A%20date%20-%20TARGET" title="Twitter"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" /></a>
	<a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F10%2Fphp-function-friday-date%2F" title="Sphinn"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F10%2Fphp-function-friday-date%2F&amp;title=PHP%20Function%20Friday%3A%20date" title="Reddit"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.jtgraphic.net/2009/10/php-function-friday-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Function Friday: function</title>
		<link>http://www.jtgraphic.net/2009/09/php-function-friday-function/</link>
		<comments>http://www.jtgraphic.net/2009/09/php-function-friday-function/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 00:29:43 +0000</pubDate>
		<dc:creator>James Thompson</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[Function Friday]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Link]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[return]]></category>
		<category><![CDATA[strtotime]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.jtgraphic.net/?p=368</guid>
		<description><![CDATA[
			
				
			
		
<p>So, I&#8217;ve decided to start including a new post every Friday &#8211; kind of as a discipline thing.  I&#8217;m going to write a post on a PHP function every Friday.  I&#8217;m not just going to regurgitate the post in the official PHP manual, but I&#8217;m going to list my experience with it along with <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.jtgraphic.net/2009/09/php-function-friday-function/">PHP Function Friday: function</a></span><p><a href="http://www.jtgraphic.net/2009/09/php-function-friday-function/">PHP Function Friday: function</a> is a post from: <a href="http://www.jtgraphic.net">jtGraphic: James Thompson</a></p>
]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F09%2Fphp-function-friday-function%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F09%2Fphp-function-friday-function%2F&amp;source=jtgraphic&amp;style=normal&amp;service=bit.ly&amp;hashtags=date,function,Function+Friday,HTML,Link,PHP,Programming,return,strtotime,time,Tutorial" height="61" width="50" /><br />
			</a>
		</div>
<p>So, I&#8217;ve decided to start including a new post every Friday &#8211; kind of as a discipline thing.  I&#8217;m going to write a post on a PHP function every Friday.  I&#8217;m not just going to regurgitate the post in the official PHP manual, but I&#8217;m going to list my experience with it along with some creative ways to use it.</p>
<p>With out any further adieu, I&#8217;m posting on the first official building block (which isn&#8217;t technically a function, but I digress) &#8216;function&#8217;:</p>
<h3>PHP Function and Syntax</h3>
<pre>function <em>&lt;function name&gt;</em>(<em>&lt;parameters&gt;</em>) {
   /*add code here*/
}
</pre>
<h3>PHP Manual Entry</h3>
<p>Check here for version information, or anything I may have missed:</p>
<p><a href="http://www.php.net/manual/en/functions.user-defined.php" target="_blank">http://www.php.net/manual/en/functions.user-defined.php</a></p>
<h3>Notes and Use</h3>
<p>This is great for building blocks of code that you repeat a lot.  I like to use it when duplicating XML/HTML code, such as links or form elements, which I will outline below.  Functions, both custom and built in, are the primary building blocks of a good program.  Everything else is just procedural.</p>
<p>Also, on a side note: <a href="http://svn.php.net/viewvc/php/php-src/trunk/CODING_STANDARDS?view=co" target="_blank">PHP Coding Standards</a> is a good read if you&#8217;re really geeky.</p>
<p>An important thing to keep in mind about making custom functions is that someone has probably already made it if it doesn&#8217;t already exist in the built in functions for PHP.  Feel free to jump online and see if someone has already made a function to do what you&#8217;re trying to do.  I like to use the site <a href="http://www.hotscripts.com/" target="_blank">HotScripts.com</a>, which has both free and commercial PHP scripts available.  Chances are: if I need it, they have it.  It saves me a ton of time.</p>
<p>Note in the examples that I precede the function with some explanation of what it does, the author, etc.  This isn&#8217;t needed, but it&#8217;s a REALLY good habit.</p>
<h4>Other Functions Referenced in Examples</h4>
<ul>
<li><a href="http://php.net/manual/en/function.return.php" target="_blank">date()</a></li>
<li><a href="http://php.net/manual/en/function.return.php" target="_blank">strtotime()</a></li>
<li><a href="http://php.net/manual/en/function.return.php" target="_blank">time()</a></li>
<li><a href="http://php.net/manual/en/function.return.php" target="_blank">return()</a></li>
</ul>
<h3>Examples</h3>
<p>Here&#8217;s the meat.  Let&#8217;s make some stuff work.</p>
<h4>Creating Image Links</h4>
<pre>/*
 *  Author: James Thompson, jtGraphic.net
 *
 *  Description
 *  ------------------------------------
 *  This function is for displaying image links in HTML.  It's less typing,
 *  and easier to remember what needs to be slashed out.  An image
 *  with the same name as the file name of the page you're linking to needs to
 *  be placed on the server in the same path as the internal variable
 *  '$image_path' and the same extension as '$image_ext'.
 *
 *  Arguments
 *  ------------------------------------
 *  $url - URL of the link
 *  $extra_tag_html - this is any extra HTML, like class, id, or style
 *
 */

/* Build the function. */

	function create_html_link($name, $extra_tag_html) {
		/* Define internal variables. */
			$image_path = "images/";
			$image_ext   = ".jpg";

		/* Output the HTML. */
			echo
				"&lt;a href="\".$name.".php\" ".$extra_tag_html."&gt;
					&lt;img src=\"".$image_path.$name.$image_ext."\" /&gt;
				&lt;/a&gt;";
	}

/* Execute the function. */

	create_html_link("home", "class=\"normal_link\"");
	create_html_link("about", "class=\"normal_link\"");
	create_html_link("contact", "class=\"normal_link\"");
</pre>
<h4>Calculate the Number of Days Since Some other Date</h4>
<pre>/*
 *  Author: James Thompson, jtGraphic.net
 *
 *  Description
 *  ------------------------------------
 *  Simple.  This calculates the number of days since X date.
 *
 *  Arguments
 *  ------------------------------------
 *  $date - the date in this format: 'YYYY-MM-DD HH:MM:SS'
 *
 */

/* Build the function. */

	function num_days_since($date) {
		/* Do some time math. */
			$date = strtotime($date);
			$now = time();
			$difference = $now - $date;
			$days = $difference / 86400;

		/* Output the Value. */
			return $days;
	}

/* Execute the function. */

	/* Should return 0 */
		echo num_days_since(date("Y-m-d H:i:s"));
	/* Someone's birthday at 6:02:55AM on Oct 23, 1974 */
		echo num_days_since("1974-10-23 06:02:55");
	/* Since Jan 1, 2009 - no need for time */
		echo num_days_since("2009-01-01");
</pre>
<h3>Examples Elsewhere on this Site:</h3>
<p><a href="http://www.jtgraphic.net/2009/10/tidbit-tuesday-php-holiday-notices-business-sites/" target="_blank">Holiday Notices</a></p>
<h3>Conclusion</h3>
<p>So that&#8217;s the basics.  Functions can be very powerful in reducing the code on your websites.  If you&#8217;d like to see some more <a href="http://www.jtgraphic.net/tag/custom-functions/" target="_blank">custom functions</a>, check out my <a href="http://www.jtgraphic.net/tag/Tidbit-Tuesday/" target="_blank">Tidbit Tuesdays on PHP</a> If you have questions, let me know in the comments.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li style="clear: both;"><a href="http://www.jtgraphic.net/2009/10/php-function-friday-date/" rel="bookmark"><img src="http://www.jtgraphic.net/wp-content/plugins/contextual-related-posts/default.png" alt="PHP Function Friday: date" title="PHP Function Friday: date" width="50" height="50" border="0" class="crp_thumb" /></a> <a href="http://www.jtgraphic.net/2009/10/php-function-friday-date/" rel="bookmark" class="crp_title">PHP Function Friday: date</a><span class="crp_excerpt"> I think the date function is extremely useful.  It gives your programs an awareness of WHEN they are.  You can ...</span></li><li style="clear: both;"><a href="http://www.jtgraphic.net/2009/10/php-function-friday-include/" rel="bookmark"><img src="http://www.jtgraphic.net/wp-content/plugins/contextual-related-posts/default.png" alt="PHP Function Friday: include" title="PHP Function Friday: include" width="50" height="50" border="0" class="crp_thumb" /></a> <a href="http://www.jtgraphic.net/2009/10/php-function-friday-include/" rel="bookmark" class="crp_title">PHP Function Friday: include</a><span class="crp_excerpt"> Including files makes it really easy to NOT duplicate code.  It's great for creating headers and footers for websites, ...</span></li><li style="clear: both;"><a href="http://www.jtgraphic.net/2009/10/tidbit-tuesday-php-holiday-notices-business-sites/" rel="bookmark"><img src="http://www.jtgraphic.net/wp-content/plugins/contextual-related-posts/default.png" alt="Tidbit Tuesday on PHP: Holiday Notices for Business Sites" title="Tidbit Tuesday on PHP: Holiday Notices for Business Sites" width="50" height="50" border="0" class="crp_thumb" /></a> <a href="http://www.jtgraphic.net/2009/10/tidbit-tuesday-php-holiday-notices-business-sites/" rel="bookmark" class="crp_title">Tidbit Tuesday on PHP: Holiday Notices for Business Sites</a><span class="crp_excerpt"> This is a handy script for managing an out of office message on your website.  I find this very useful ...</span></li></ul></div><p><a href="http://www.jtgraphic.net/2009/09/php-function-friday-function/">PHP Function Friday: function</a> is a post from: <a href="http://www.jtgraphic.net">jtGraphic: James Thompson</a></p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F09%2Fphp-function-friday-function%2F&amp;title=PHP%20Function%20Friday%3A%20function&amp;bodytext=So%2C%20I%27ve%20decided%20to%20start%20including%20a%20new%20post%20every%20Friday%20-%20kind%20of%20as%20a%20discipline%20thing.%20%20I%27m%20going%20to%20write%20a%20post%20on%20a%20PHP%20function%20every%20Friday.%20%20I%27m%20not%20just%20going%20to%20regurgitate%20the%20post%20in%20the%20official%20PHP%20manual%2C%20but%20I%27m%20going%20to%20list%20my%20e" title="Digg"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F09%2Fphp-function-friday-function%2F&amp;title=PHP%20Function%20Friday%3A%20function&amp;notes=So%2C%20I%27ve%20decided%20to%20start%20including%20a%20new%20post%20every%20Friday%20-%20kind%20of%20as%20a%20discipline%20thing.%20%20I%27m%20going%20to%20write%20a%20post%20on%20a%20PHP%20function%20every%20Friday.%20%20I%27m%20not%20just%20going%20to%20regurgitate%20the%20post%20in%20the%20official%20PHP%20manual%2C%20but%20I%27m%20going%20to%20list%20my%20e" title="del.icio.us"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.jtgraphic.net/wp-content/plugins/sociable/awesmate.php?c=facebook-post&t=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F09%2Fphp-function-friday-function%2F&d=http://www.facebook.com/share.php?u=TARGET%26t=PHP%20Function%20Friday%3A%20function" title="Facebook"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F09%2Fphp-function-friday-function%2F&amp;title=PHP%20Function%20Friday%3A%20function" title="Mixx"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F09%2Fphp-function-friday-function%2F&amp;title=PHP%20Function%20Friday%3A%20function&amp;annotation=So%2C%20I%27ve%20decided%20to%20start%20including%20a%20new%20post%20every%20Friday%20-%20kind%20of%20as%20a%20discipline%20thing.%20%20I%27m%20going%20to%20write%20a%20post%20on%20a%20PHP%20function%20every%20Friday.%20%20I%27m%20not%20just%20going%20to%20regurgitate%20the%20post%20in%20the%20official%20PHP%20manual%2C%20but%20I%27m%20going%20to%20list%20my%20e" title="Google Bookmarks"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F09%2Fphp-function-friday-function%2F&amp;title=PHP%20Function%20Friday%3A%20function" title="StumbleUpon"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F09%2Fphp-function-friday-function%2F" title="Technorati"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.jtgraphic.net/wp-content/plugins/sociable/awesmate.php?c=myspace&t=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F09%2Fphp-function-friday-function%2F&d=http://www.myspace.com/Modules/PostTo/Pages/?u=TARGET%26t=PHP%20Function%20Friday%3A%20function" title="MySpace"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.jtgraphic.net/wp-content/plugins/sociable/awesmate.php?c=twitter&t=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F09%2Fphp-function-friday-function%2F&d=http://twitter.com/home?status=PHP%20Function%20Friday%3A%20function%20-%20TARGET" title="Twitter"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" /></a>
	<a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F09%2Fphp-function-friday-function%2F" title="Sphinn"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.jtgraphic.net%2F2009%2F09%2Fphp-function-friday-function%2F&amp;title=PHP%20Function%20Friday%3A%20function" title="Reddit"><img src="http://www.jtgraphic.net/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.jtgraphic.net/2009/09/php-function-friday-function/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
