<?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>Colin Loretz &#187; Code</title>
	<atom:link href="http://colinloretz.com/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://colinloretz.com</link>
	<description>Community builder and hacker</description>
	<lastBuildDate>Mon, 14 Nov 2011 20:39:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Hack for Change in Reno</title>
		<link>http://colinloretz.com/2011/10/hack-for-change-in-reno/</link>
		<comments>http://colinloretz.com/2011/10/hack-for-change-in-reno/#comments</comments>
		<pubDate>Sun, 02 Oct 2011 22:38:23 +0000</pubDate>
		<dc:creator>Colin Loretz</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Featured]]></category>

		<guid isPermaLink="false">http://colinloretz.com/?p=909</guid>
		<description><![CDATA[Reno is about to get hacked, in a good way. Reno Collective has partnered with the City of Reno in order to put on the first Hack4Reno event in downtown Reno. For 24 hours, teams from all over Northern Nevada will set off to build apps, websites, services and tools that help make Reno a [...]]]></description>
			<content:encoded><![CDATA[<p>Reno is about to get hacked, in a good way. <a href="http://renocollective.com" target="_blank">Reno Collective</a> has partnered with the City of Reno in order to put on the first <a href="http://hack4reno" target="_blank">Hack4Reno</a> event in downtown Reno. For 24 hours, teams from all over Northern Nevada will set off to build apps, websites, services and tools that help make Reno a smarter, more engaged city.<span id="more-909"></span></p>
<p>The event is called Hack4Reno and includes a 24 hour hackathon where teams of developers and designers will build applications (web apps, websites, mobile apps, tools, etc) that either uses openly available data or collects it. We are working with companies like Github, Tropo and MediaTemple and other web applications that provide services for other developers to build their own apps and are looking for teams to build apps that benefit the Reno community.</p>
<h3>Build the future, win prizes&#8230;fame and glory</h3>
<p>The applications will be built over 24 hours at the event, which is being held at the Pioneer Center in downtown Reno. We are making this event very transparent and open to the community so that Reno can see what goes into building web apps. Teams will then have time to present their finished applications for judging to win various prizes like Apple products and a Best in Show cash prize.</p>
<h3>An open source future</h3>
<p>This event is a barn raising for the Reno tech community. We are not seeking any financial sponsorships as the entire event is being put on in a very open source manner and we instead are asking for support in terms of promotion and/or resources as they are available.</p>
<h3>Not just for techies</h3>
<p>While I keep talking about designers and developers, the kinds of apps that I’m talking about are even things like online news and aggregation websites. Things like <a href="http://thebolditalic.com">The Bold Italic</a> or <a href="http://good.is">GOOD</a> are wonderful examples of story telling and technology/digital media coming together. We have quite a few classes leading up to the hackathon that are free and available for students (or professors) to learn new things about various technologies, open data and open government.</p>
]]></content:encoded>
			<wfw:commentRss>http://colinloretz.com/2011/10/hack-for-change-in-reno/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Your Web App is in my WordPress!</title>
		<link>http://colinloretz.com/2011/05/your-web-app-is-in-my-wordpress/</link>
		<comments>http://colinloretz.com/2011/05/your-web-app-is-in-my-wordpress/#comments</comments>
		<pubDate>Thu, 05 May 2011 15:07:06 +0000</pubDate>
		<dc:creator>Colin Loretz</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://colinloretz.com/?p=837</guid>
		<description><![CDATA[Below is a talk I gave at Las Vegas WordCamp in Fall 2010 on building web app mashups with WordPress and the options available for doing so.]]></description>
			<content:encoded><![CDATA[<p>Below is a talk I gave at Las Vegas WordCamp in Fall 2010 on building web app mashups with WordPress and the options available for doing so.</p>
<p><embed type="application/x-shockwave-flash" src="http://s0.videopress.com/player.swf?v=1.02" width="400" height="224" wmode="transparent" seamlesstabbing="true" allowfullscreen="true" allowscriptaccess="always" overstretch="true" flashvars="guid=AVROdp1x"></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://colinloretz.com/2011/05/your-web-app-is-in-my-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reno Tahoe WordCamp 2010 is a wrap!</title>
		<link>http://colinloretz.com/2010/06/reno-tahoe-wordcamp-2010-is-a-wrap/</link>
		<comments>http://colinloretz.com/2010/06/reno-tahoe-wordcamp-2010-is-a-wrap/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 22:00:30 +0000</pubDate>
		<dc:creator>Colin Loretz</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[rtwc10]]></category>

		<guid isPermaLink="false">http://colinloretz.com/?p=656</guid>
		<description><![CDATA[Reno&#8217;s second annual WordCamp was a huge success! Thanks for everyone who came out. Check out pictures from the event!]]></description>
			<content:encoded><![CDATA[<p>Reno&#8217;s second annual WordCamp was a huge success! Thanks for everyone who came out. Check out pictures from the event!</p>
<p><object width="450" height="338"><param name="flashvars" value="offsite=true&#038;lang=en-us&#038;page_show_url=%2Fphotos%2Frenocollective%2Fsets%2F72157624157392719%2Fshow%2F&#038;page_show_back_url=%2Fphotos%2Frenocollective%2Fsets%2F72157624157392719%2F&#038;set_id=72157624157392719&#038;jump_to="></param><param name="movie" value="http://www.flickr.com/apps/slideshow/show.swf?v=71649"></param><param name="allowFullScreen" value="true"></param><embed type="application/x-shockwave-flash" src="http://www.flickr.com/apps/slideshow/show.swf?v=71649" allowFullScreen="true" flashvars="offsite=true&#038;lang=en-us&#038;page_show_url=%2Fphotos%2Frenocollective%2Fsets%2F72157624157392719%2Fshow%2F&#038;page_show_back_url=%2Fphotos%2Frenocollective%2Fsets%2F72157624157392719%2F&#038;set_id=72157624157392719&#038;jump_to=" width="450" height="338"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://colinloretz.com/2010/06/reno-tahoe-wordcamp-2010-is-a-wrap/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Reno-Tahoe WordCamp Shirts</title>
		<link>http://colinloretz.com/2010/06/reno-tahoe-wordcamp-shirts/</link>
		<comments>http://colinloretz.com/2010/06/reno-tahoe-wordcamp-shirts/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 18:33:42 +0000</pubDate>
		<dc:creator>Colin Loretz</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://colinloretz.com/?p=647</guid>
		<description><![CDATA[Reno-Tahoe WordCamp 2010 is in 9 days! Here are the shirts for this year&#8217;s event, designed by Diego Sabogal. Only the first 150 registered attendees will receive a shirt so sign up now!]]></description>
			<content:encoded><![CDATA[<p><a href="http://renotahoewordcamp.com" target="_blank"><br />
Reno-Tahoe WordCamp 2010</a> is in 9 days! Here are the shirts for this year&#8217;s event, designed by <a href="http://theartofdiego.com" target="_blank">Diego Sabogal</a>. Only the first 150 registered attendees will receive a shirt so <a href = "http://renotahoewordcamp.eventbrite.com" target = "_blank">sign up now!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://colinloretz.com/2010/06/reno-tahoe-wordcamp-shirts/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WordPress as a CMS on WordPress.TV</title>
		<link>http://colinloretz.com/2010/06/wordpress-as-a-cms-on-wordpress-tv/</link>
		<comments>http://colinloretz.com/2010/06/wordpress-as-a-cms-on-wordpress-tv/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 17:33:46 +0000</pubDate>
		<dc:creator>Colin Loretz</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://colinloretz.com/?p=644</guid>
		<description><![CDATA[Here is video from the presentation I did at the Orange County WordCamp 2010 discussing specific methods for using WordPress as a content management system, including when WordPress is best for your site and how you can optimize your WordPress use for a complete site. Video provided by Blaze Streaming Media]]></description>
			<content:encoded><![CDATA[<p>Here is <a href = "http://wordpress.tv/2010/04/24/colin-loretz-wordpress-as-cms-oc10/" target= "_blank">video</a> from the presentation I did at the Orange County WordCamp 2010 discussing specific methods for using WordPress as a content management system, including when WordPress is best for your site and how you can optimize your WordPress use for a complete site.</p>
<p>Video provided by <a href="http://www.blazestreaming.com/" target="_blank">Blaze Streaming Media</a></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="220" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="flashvars" value="guid=rLQQkuBV&amp;width=400&amp;height=220&amp;locksize=no&amp;dynamicseek=false&amp;qc_publisherId=p-18-mFEk4J448M" /><param name="src" value="http://v.wordpress.com/wp-content/plugins/video/flvplayer.swf?ver=1.21" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="400" height="220" src="http://v.wordpress.com/wp-content/plugins/video/flvplayer.swf?ver=1.21" allowfullscreen="true" flashvars="guid=rLQQkuBV&amp;width=400&amp;height=220&amp;locksize=no&amp;dynamicseek=false&amp;qc_publisherId=p-18-mFEk4J448M"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://colinloretz.com/2010/06/wordpress-as-a-cms-on-wordpress-tv/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OC WordCamp: WordPress as a CMS</title>
		<link>http://colinloretz.com/2010/04/oc-wordcamp-wordpress-as-a-cms/</link>
		<comments>http://colinloretz.com/2010/04/oc-wordcamp-wordpress-as-a-cms/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 19:05:47 +0000</pubDate>
		<dc:creator>Colin Loretz</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[lively labs]]></category>
		<category><![CDATA[orange county]]></category>
		<category><![CDATA[wordcamp]]></category>

		<guid isPermaLink="false">http://colinloretz.com/?p=635</guid>
		<description><![CDATA[Here are my slides from my presentation at OC WordCamp this weekend. It was a great event and I hope everyone learned a few things! If you&#8217;ve never been to an event like this and you use WordPress, or are interested in learning more about the platform, look for a WordCamp in your area. The [...]]]></description>
			<content:encoded><![CDATA[<p>Here are my slides from my presentation at <a href="http://www.ocwordcamp.com" target="_blank">OC WordCamp</a> this weekend. It was a great event and I hope everyone learned a few things! If you&#8217;ve never been to an event like this and you use WordPress, or are interested in learning more about the platform, look for a WordCamp in your area. The 2nd annual <a href="http://renotahoewordcamp.com" target="_blank">Reno-Tahoe WordCamp</a> is just around the corner on June 12th!</p>
<div style="width: 425px;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=wpasacms-100426140032-phpapp01&amp;stripped_title=wp-as-acms" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=wpasacms-100426140032-phpapp01&amp;stripped_title=wp-as-acms" allowscriptaccess="always" allowfullscreen="true"></embed></object></div>
]]></content:encoded>
			<wfw:commentRss>http://colinloretz.com/2010/04/oc-wordcamp-wordpress-as-a-cms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WP Builder: An IDE for WordPress Plugins &amp; Themes</title>
		<link>http://colinloretz.com/2010/04/wp-builder-an-ide-for-wordpress-plugins-themes/</link>
		<comments>http://colinloretz.com/2010/04/wp-builder-an-ide-for-wordpress-plugins-themes/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 16:54:57 +0000</pubDate>
		<dc:creator>Colin Loretz</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[google summer of code]]></category>
		<category><![CDATA[gsoc]]></category>

		<guid isPermaLink="false">http://colinloretz.com/?p=618</guid>
		<description><![CDATA[I submitted an application to Google&#8217;s Summer of Code last year on building a CMS Theme Framework for wordpress and I&#8217;m back at it this year. An IDE for WordPress Plugins &#38; Themes My proposal for GSOC 2010 is an integrated development environment for WordPress to allow for integration between the code editor, publishing, developer [...]]]></description>
			<content:encoded><![CDATA[<p>I submitted an application to Google&#8217;s Summer of Code last year on building a <a href="http://colinloretz.com/2009/04/a-cms-theme-framework-for-wordpress/">CMS Theme Framework</a> for wordpress and I&#8217;m back at it this year.</p>
<h2>An IDE for WordPress Plugins &amp; Themes</h2>
<p>My proposal for GSOC 2010 is an integrated development environment for WordPress to allow for integration between the code editor, publishing, developer collaboration and the <a href="http://codex.wordpress.org/Main_Page">WordPress codex</a>.</p>
<h3 style="font-size: 1.17em;">Features</h3>
<ul>
<li><strong style="font-weight: bold;">Open Source: </strong>Built on <a href="http://www.eclipse.org/">Eclipse</a></li>
<li><strong style="font-weight: bold;">Code Share: </strong>Share and collaborate on WordPress projects with fellow developers using Git or SVN</li>
<li><strong style="font-weight: bold;">Publishing:</strong> Setup FTP to allow for publishing your plugin to a WordPress installation to see your progress and test out functionality</li>
<li><strong style="font-weight: bold;">WordPress Codex Autocomplete:</strong> Start typing out a wordpress tag and the IDE will display autocomplete options and relevant parameters for each.</li>
<li><strong style="font-weight: bold;">WordPress Codex Wizard</strong>: Forgot what codex tags to use when you&#8217;re developing a theme or plugin? The Codex Wizard can help you browse the WordPress Codex and build your queries without leaving the IDE.</li>
</ul>
<h3><strong>Example of a WordPress Theme developer&#8217;s workflow in WP Builder</strong></h3>
<ol>
<li>Start Eclipse</li>
<li>Create New Project</li>
<li>Select WordPress Theme Project</li>
<li>WP Builder will create a project with a basic template structure (index.php, page.php, single.php, etc.)</li>
<li>Edit theme files within Eclipse</li>
<li>Browse the Codex for template tags within the Codex Wizard</li>
<li>Enter FTP information for a WordPress installation to see changes live on the web</li>
</ol>
<h3>Example of a WordPress Plugin developer&#8217;s workflow in WP Builder</h3>
<ol>
<li>Start Eclipse</li>
<li>Create New Project</li>
<li>Select WordPress Plugin Project</li>
<li>Select options such as &#8220;Include backend admin panel, etc.&#8221;</li>
<li>WP Builder will create a project with an empty plugin shell</li>
<li>Share project files with another developer across the world using a GitHub repository or SVN</li>
<li>Enter FTP information for a WordPress installation to see changes live on the web</li>
</ol>
<h3>Future Roadmap Features</h3>
<p>These features are a little ambitious for the GSOC program timeline but as future features could include:</p>
<ul>
<li>Testing &amp; Debugging</li>
<li>WYSIWYG editor for theme development</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://colinloretz.com/2010/04/wp-builder-an-ide-for-wordpress-plugins-themes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WoW: World of WordPress</title>
		<link>http://colinloretz.com/2010/03/wow-world-of-wordpress/</link>
		<comments>http://colinloretz.com/2010/03/wow-world-of-wordpress/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 23:35:39 +0000</pubDate>
		<dc:creator>Colin Loretz</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://colinloretz.com/?p=601</guid>
		<description><![CDATA[It&#8217;s a busy time in the world of WordPress. The Lively Labs crew will be out and about for various WordCamps over the next couple months. We use WordPress heavily as our content management system of choice for most projects and are always glad to be involved and contribute to the community. April 24th: Orange [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a busy time in the world of WordPress. The <a href = "http://livelylabs.com" target = "_blank">Lively Labs</a> crew will be out and about for various WordCamps over the next couple months. We use WordPress heavily as our content management system of choice for most projects and are always glad to be involved and contribute to the community.</p>
<h3><a href = "http://ocwordcamp.com" target = "_blank">April 24th: Orange County WordCamp</a></h3>
<p>I&#8217;ll be presenting on &#8220;Using WordPress as a Content Management System (CMS)&#8221;  at the OC WordCamp down at UC Irvine. Come check it out!</p>
<h3><a href = "http://2010.sf.wordcamp.org/" target = "_blank">May 1st: San Francisco WordCamp</a></h3>
<p>Ed, Chelsea and I attended SF WordCamp last year and it was great to meet a lot of new people in the WordPress community such as our friends over at <a href = "http://shaneandpeter.com" target = "_blank">Shane &#038; Peter</a> and <a href= "http://nextspace.us" target = "_blank">NextSpace</a>.  We are definitely looking forward to it again this year.</p>
<h3><a href = "http://www.renotahoewordcamp.com" target = "_blank">June 12: Reno-Tahoe WordCamp</a></h3>
<p>The 2nd annual Reno-Tahoe WordCamp is going to much larger than the first. We have already confirmed it will be held in the ballrooms of the university thanks to sponsorship by the UNR Business Student Council. This event is key to the development of Reno&#8217;s tech culture. We have a lot of great developers, bloggers and more in this town and we want to continue to help them in any way possible. The call for proposals is now open so if you&#8217;d like to speak, make sure you get your presentation submitted! A new website is going up soon but for now, you can find details at <a href = "http://www.renotahoewordcamp.com" target = "_blank">www.renotahoewordcamp.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://colinloretz.com/2010/03/wow-world-of-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Call for Proposals now open for Reno-Tahoe Wordcamp 2010</title>
		<link>http://colinloretz.com/2010/01/call-for-proposals-now-open-for-reno-tahoe-wordcamp-2010/</link>
		<comments>http://colinloretz.com/2010/01/call-for-proposals-now-open-for-reno-tahoe-wordcamp-2010/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 01:07:49 +0000</pubDate>
		<dc:creator>Colin Loretz</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Reno]]></category>
		<category><![CDATA[reno-tahoe]]></category>
		<category><![CDATA[wordcamp]]></category>

		<guid isPermaLink="false">http://colinloretz.com/?p=595</guid>
		<description><![CDATA[The first Reno-Tahoe WordCamp was a great success and we are looking forward to an even better one this year. We have a lot of great things lined up but we can't make the day a success without your help!]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-596" title="wp" src="http://colinloretz.com/wp-content/uploads/2010/01/wp-300x223.png" alt="Dave LaPlante and Matt Mullenweg at Reno-Tahoe WordCamp 2010" width="300" height="223" /></p>
<p>The first Reno-Tahoe WordCamp was a great success and we are looking forward to an even better one this year. We have a lot of great things lined up but we can&#8217;t make the day a success without your help!</p>
<p>Are you a WordPress guru, blogger, podcaster, writer or community builder? If so, then you should consider <a title="Call for Proposals - Reno-Tahoe WordCamp 2010" onclick="window.open('http://renowordcamp.wufoo.com/forms/z7x4a9/',  null, 'height=1174, width=680, toolbar=0, location=0, status=1, scrollbars=1,resizable=1'); return false" href="#">submitting a proposal to present</a> on  June 12th <span style="text-decoration: line-through;">April 10th</span>.</p>
<p>The official website for Reno-Tahoe WordCamp 2010 will be available soon with more information. If you have any questions, feel free to send an email to renotahoewordcamp@gmail.com.</p>
]]></content:encoded>
			<wfw:commentRss>http://colinloretz.com/2010/01/call-for-proposals-now-open-for-reno-tahoe-wordcamp-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calculating the day of the week in Apex code</title>
		<link>http://colinloretz.com/2010/01/calculating-the-day-of-the-week/</link>
		<comments>http://colinloretz.com/2010/01/calculating-the-day-of-the-week/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 09:41:48 +0000</pubDate>
		<dc:creator>Colin Loretz</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Salesforce.com]]></category>

		<guid isPermaLink="false">http://colinloretz.com/?p=582</guid>
		<description><![CDATA[Formatting dates has always been the bane of my existence and tonight, I couldn&#8217;t figure out how to calculate the day of the week based on a date when coding in apex on the Force.com platform. I found this wikipedia article: Calculating the day of the week and used it to build the following function. [...]]]></description>
			<content:encoded><![CDATA[<p>Formatting dates has always been the bane of my existence and tonight, I couldn&#8217;t figure out how to calculate the <strong>day of the week</strong> based on a date when coding in apex on the Force.com platform. I found this wikipedia article: <a href = "http://en.wikipedia.org/wiki/Calculating_the_day_of_the_week">Calculating the day of the week</a> and used it to build the following function.</p>
<p>This function will determine the day of the week for any date, including leap years. It can be cleaned up considerably but I figured I would share my geekery with you all in raw form. (Y3k bug: note the <em>- 2000</em> to calculate the last two digits of the year.)<br />
<span id="more-582"></span></p>
<pre>public String readableDay(Date dateToFormat)
{
	String dayOfWeekString = '';
	Integer day = dateToFormat.day();
	Integer month = dateToFormat.month();

	//Get last two digits of year
	Integer twoDigitYear = dateToFormat.year() - 2000;

	//Get first two digits of year
	String centuryYear = String.valueOf(deadline.year());
	centuryYear = centuryYear.substring(0,2);
	Integer centuryYearInt = Integer.valueOf(centuryYear);

	//Centuries: c = 2(3 - (century mod 4))
	//century = last two numbers of the year
	Integer modYear = math.mod(centuryYearInt, 4);
	modYear = 3 - modYear;
	Integer century = 2 * modYear;
	System.debug('Century: ' + century);

	//Years: y = year + (year / 4)
	Integer years = twoDigitYear + (twoDigitYear / 4);

	//Months (check if leap year)
	Integer monthResult = 0;

	if(month == 1)
	{
		if(math.mod(deadline.year(), 4) == 0)
			monthResult = 6;	//leap year
		else
			monthResult = 0;	//not leap year
	}
	else if(month == 2)
	{
		if(math.mod(deadline.year(), 4) == 0)
			monthResult = 2;	//leap year
		else
			monthResult = 3;	//not leap year
	}
	else if(month == 3)
		monthResult = 3;
	else if(month == 4)
		monthResult = 6;
	else if(month == 5)
		monthResult = 1;
	else if(month == 6)
		monthResult = 4;
	else if(month == 7)
		monthResult = 6;
	else if(month == 8)
		monthResult = 2;
	else if(month == 9)
		monthResult = 5;
	else if(month == 10)
		monthResult = 0;
	else if(month == 11)
		monthResult = 3;
	else if(month == 12)
		monthResult = 5;

	//Calculate Running Total
	Integer runningTotal = century + years + monthResult + day;

	//Calculate mod of week
	Integer dayOfWeek = math.mod(runningTotal, 7);

	//Day of Week Table
	if(dayOfWeek == 0)
		dayOfWeekString = 'Sunday';
	else if(dayOfWeek == 1)
		dayOfWeekString = 'Monday';
	else if(dayOfWeek == 2)
		dayOfWeekString = 'Tuesday';
	else if(dayOfWeek == 3)
		dayOfWeekString = 'Wednesday';
	else if(dayOfWeek == 4)
		dayOfWeekString = 'Thursday';
	else if(dayOfWeek == 5)
		dayOfWeekString = 'Friday';
	else if(dayOfWeek == 6)
		dayOfWeekString = 'Saturday';

	return dayOfWeekString;

}</pre>
]]></content:encoded>
			<wfw:commentRss>http://colinloretz.com/2010/01/calculating-the-day-of-the-week/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

