<?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: Calculating the day of the week in Apex code</title>
	<atom:link href="http://colinloretz.com/2010/01/calculating-the-day-of-the-week/feed/" rel="self" type="application/rss+xml" />
	<link>http://colinloretz.com/2010/01/calculating-the-day-of-the-week/</link>
	<description>Community builder and hacker</description>
	<lastBuildDate>Tue, 31 Jan 2012 14:11:02 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: Christian</title>
		<link>http://colinloretz.com/2010/01/calculating-the-day-of-the-week/#comment-111</link>
		<dc:creator>Christian</dc:creator>
		<pubDate>Fri, 18 Jun 2010 05:37:58 +0000</pubDate>
		<guid isPermaLink="false">http://colinloretz.com/?p=582#comment-111</guid>
		<description>What about:

public String readableDay(Date d) {

    Datetime dt = DateTime.newInstance(d.year(), d.month(), d.day());
    return dt.format(&#039;EEEE&#039;);

}</description>
		<content:encoded><![CDATA[<p>What about:</p>
<p>public String readableDay(Date d) {</p>
<p>    Datetime dt = DateTime.newInstance(d.year(), d.month(), d.day());<br />
    return dt.format(&#8216;EEEE&#8217;);</p>
<p>}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will Nourse</title>
		<link>http://colinloretz.com/2010/01/calculating-the-day-of-the-week/#comment-110</link>
		<dc:creator>Will Nourse</dc:creator>
		<pubDate>Tue, 12 Jan 2010 17:15:20 +0000</pubDate>
		<guid isPermaLink="false">http://colinloretz.com/?p=582#comment-110</guid>
		<description>Here&#039;s how I do it in formula fields:

CASE(MOD(  Record_Date__c  - DATE(1900, 1, 6), 7), 0, &quot;Saturday&quot;, 1, &quot;Sunday&quot;, 2, &quot;Monday&quot;, 3, &quot;Tuesday&quot;, 4, &quot;Wednesday&quot;, 5, &quot;Thursday&quot;, 6, &quot;Friday&quot;,&quot;&quot;)</description>
		<content:encoded><![CDATA[<p>Here&#8217;s how I do it in formula fields:</p>
<p>CASE(MOD(  Record_Date__c  &#8211; DATE(1900, 1, 6), 7), 0, &#8220;Saturday&#8221;, 1, &#8220;Sunday&#8221;, 2, &#8220;Monday&#8221;, 3, &#8220;Tuesday&#8221;, 4, &#8220;Wednesday&#8221;, 5, &#8220;Thursday&#8221;, 6, &#8220;Friday&#8221;,&#8221;")</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Colin Loretz</title>
		<link>http://colinloretz.com/2010/01/calculating-the-day-of-the-week/#comment-109</link>
		<dc:creator>Colin Loretz</dc:creator>
		<pubDate>Tue, 12 Jan 2010 15:24:22 +0000</pubDate>
		<guid isPermaLink="false">http://colinloretz.com/?p=582#comment-109</guid>
		<description>I had thought of the second option but it won&#039;t be reliable for an application that is meant to be used in places where the beginning of the week is not Sunday, but instead Monday.

toStartOfWeek: &quot;Returns the start of the week for the Date that called the method, depending on the context user&#039;s locale. For example, the start of a week is Sunday in the United States locale, and Monday in European locales.&quot;</description>
		<content:encoded><![CDATA[<p>I had thought of the second option but it won&#8217;t be reliable for an application that is meant to be used in places where the beginning of the week is not Sunday, but instead Monday.</p>
<p>toStartOfWeek: &#8220;Returns the start of the week for the Date that called the method, depending on the context user&#8217;s locale. For example, the start of a week is Sunday in the United States locale, and Monday in European locales.&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marco Casalaina</title>
		<link>http://colinloretz.com/2010/01/calculating-the-day-of-the-week/#comment-108</link>
		<dc:creator>Marco Casalaina</dc:creator>
		<pubDate>Tue, 12 Jan 2010 11:24:41 +0000</pubDate>
		<guid isPermaLink="false">http://colinloretz.com/?p=582#comment-108</guid>
		<description>Two things I would have tried:

1.  If you convert it to a DateTime then you could probably use DateTime.format to emit the day string.
2.  You could also keep it as Date but subtract it from the beginning of the week (which presumably is a Sunday), like

date myDate = date.today();
date weekStart = myDate.toStartofWeek();
integer dayOfWeek=
     weekStart.daysBetween(myDate);

Then you could apply your if statement to get the corresponding string.</description>
		<content:encoded><![CDATA[<p>Two things I would have tried:</p>
<p>1.  If you convert it to a DateTime then you could probably use DateTime.format to emit the day string.<br />
2.  You could also keep it as Date but subtract it from the beginning of the week (which presumably is a Sunday), like</p>
<p>date myDate = date.today();<br />
date weekStart = myDate.toStartofWeek();<br />
integer dayOfWeek=<br />
     weekStart.daysBetween(myDate);</p>
<p>Then you could apply your if statement to get the corresponding string.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

