<?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: Computer Algorithms: How to Determine the Day of the Week</title>
	<atom:link href="/2012/04/24/computer-algorithms-how-to-determine-the-day-of-the-week/feed/" rel="self" type="application/rss+xml" />
	<link>/2012/04/24/computer-algorithms-how-to-determine-the-day-of-the-week/</link>
	<description>on web development</description>
	<lastBuildDate>Fri, 26 Oct 2018 21:40:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>By: James Venable</title>
		<link>/2012/04/24/computer-algorithms-how-to-determine-the-day-of-the-week/comment-page-1/#comment-488418</link>
		<dc:creator><![CDATA[James Venable]]></dc:creator>
		<pubDate>Wed, 02 May 2018 21:43:52 +0000</pubDate>
		<guid isPermaLink="false">/?p=3058#comment-488418</guid>
		<description><![CDATA[Wrote from information from your post. Thanks.

uint8_t rtc_DOW(uint8_t y, uint8_t m, uint8_t d)
{
// Added 1 to Jan, Feb.
// Subtracted 1 from each instead of adding 6 in calc below.
static const uint8_t mTable[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};

// Year is 0 - 99, rep years 2000 - 2099
// Month starts at 0.
// Day starts at 1.

// Subtract 1 in calc for Jan, Feb, only in leap years.
// Subtracting 1 from year has the effect of subtracting 2 in leap years, subtracting 1 otherwise.
// Adding 1 for Jan, Feb in Month Table so calc ends up subtracting 1 for Jan, Feb, only in leap years.
// All of this complication to avoid the check if it is a leap year.
if (m &#062; 2)) % 7;

} /* end */]]></description>
		<content:encoded><![CDATA[<p>Wrote from information from your post. Thanks.</p>
<p>uint8_t rtc_DOW(uint8_t y, uint8_t m, uint8_t d)<br />
{<br />
// Added 1 to Jan, Feb.<br />
// Subtracted 1 from each instead of adding 6 in calc below.<br />
static const uint8_t mTable[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};</p>
<p>// Year is 0 &#8211; 99, rep years 2000 &#8211; 2099<br />
// Month starts at 0.<br />
// Day starts at 1.</p>
<p>// Subtract 1 in calc for Jan, Feb, only in leap years.<br />
// Subtracting 1 from year has the effect of subtracting 2 in leap years, subtracting 1 otherwise.<br />
// Adding 1 for Jan, Feb in Month Table so calc ends up subtracting 1 for Jan, Feb, only in leap years.<br />
// All of this complication to avoid the check if it is a leap year.<br />
if (m &gt; 2)) % 7;</p>
<p>} /* end */</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Venable</title>
		<link>/2012/04/24/computer-algorithms-how-to-determine-the-day-of-the-week/comment-page-1/#comment-488417</link>
		<dc:creator><![CDATA[James Venable]]></dc:creator>
		<pubDate>Wed, 02 May 2018 21:36:43 +0000</pubDate>
		<guid isPermaLink="false">/?p=3058#comment-488417</guid>
		<description><![CDATA[Thanks for the post. From this information I wrote this C function.

uint8_t rtc_DayOfWeek(uint8_t year, uint8_t month, uint8_t day)
{
//static const uint8_t month_offset_table[] = {0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5}; // Typical table.

// Added 1 to Jan, Feb. Subtracted 1 from each instead of adding 6 in calc below. */
static const uint8_t month_offset_table[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};

uint8_t day_of_week;

	// Year is 0 - 99, representing years 2000 - 2099

	// Month starts at 0.
	month -= 1;

	// Day starts at 1.

	// Subtract 1 in calc for Jan, Feb, only in leap years.
	// Subtracting 1 from year has the effect of subtracting 2 in leap years, subtracting 1 otherwise.
	// Adding 1 for Jan, Feb in Month Table so calc ends up subtracting 1 for Jan, Feb, only in leap years.
	// All of this complication to avoid the check if it is a leap year.
	if (month &#062; 2)) % 7;

    // Sunday (0) ...
	return day_of_week;

} /* end rtc_DayOfWeek() */

Enjoy.]]></description>
		<content:encoded><![CDATA[<p>Thanks for the post. From this information I wrote this C function.</p>
<p>uint8_t rtc_DayOfWeek(uint8_t year, uint8_t month, uint8_t day)<br />
{<br />
//static const uint8_t month_offset_table[] = {0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5}; // Typical table.</p>
<p>// Added 1 to Jan, Feb. Subtracted 1 from each instead of adding 6 in calc below. */<br />
static const uint8_t month_offset_table[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};</p>
<p>uint8_t day_of_week;</p>
<p>	// Year is 0 &#8211; 99, representing years 2000 &#8211; 2099</p>
<p>	// Month starts at 0.<br />
	month -= 1;</p>
<p>	// Day starts at 1.</p>
<p>	// Subtract 1 in calc for Jan, Feb, only in leap years.<br />
	// Subtracting 1 from year has the effect of subtracting 2 in leap years, subtracting 1 otherwise.<br />
	// Adding 1 for Jan, Feb in Month Table so calc ends up subtracting 1 for Jan, Feb, only in leap years.<br />
	// All of this complication to avoid the check if it is a leap year.<br />
	if (month &gt; 2)) % 7;</p>
<p>    // Sunday (0) &#8230;<br />
	return day_of_week;</p>
<p>} /* end rtc_DayOfWeek() */</p>
<p>Enjoy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dr. Khaled Bizri</title>
		<link>/2012/04/24/computer-algorithms-how-to-determine-the-day-of-the-week/comment-page-1/#comment-485829</link>
		<dc:creator><![CDATA[Dr. Khaled Bizri]]></dc:creator>
		<pubDate>Tue, 10 Apr 2018 03:57:41 +0000</pubDate>
		<guid isPermaLink="false">/?p=3058#comment-485829</guid>
		<description><![CDATA[Take the problem of finding the day of the week on which 01-01-2000 falls:

According to the algorithm:
1. From the Centuries Table, 2000 corresponds to 6. 
2. The last two digits if the year are simply   0.
3. zero mod 4 is 0.
4. From the Month Table, for a leap year (2000) January&#039;s code is 6. 
5. the sum of 6 + 0 + 0 + 6 is 12.
6. 12 mod 7 is 5.
7. The implied day is Friday.

But the actual day is Saturday!]]></description>
		<content:encoded><![CDATA[<p>Take the problem of finding the day of the week on which 01-01-2000 falls:</p>
<p>According to the algorithm:<br />
1. From the Centuries Table, 2000 corresponds to 6.<br />
2. The last two digits if the year are simply   0.<br />
3. zero mod 4 is 0.<br />
4. From the Month Table, for a leap year (2000) January&#8217;s code is 6.<br />
5. the sum of 6 + 0 + 0 + 6 is 12.<br />
6. 12 mod 7 is 5.<br />
7. The implied day is Friday.</p>
<p>But the actual day is Saturday!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Angel angel</title>
		<link>/2012/04/24/computer-algorithms-how-to-determine-the-day-of-the-week/comment-page-1/#comment-468928</link>
		<dc:creator><![CDATA[Angel angel]]></dc:creator>
		<pubDate>Fri, 13 Oct 2017 12:36:53 +0000</pubDate>
		<guid isPermaLink="false">/?p=3058#comment-468928</guid>
		<description><![CDATA[How can u say it is Wednesday and not sunday]]></description>
		<content:encoded><![CDATA[<p>How can u say it is Wednesday and not sunday</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manish ghimire</title>
		<link>/2012/04/24/computer-algorithms-how-to-determine-the-day-of-the-week/comment-page-1/#comment-461775</link>
		<dc:creator><![CDATA[Manish ghimire]]></dc:creator>
		<pubDate>Fri, 11 Aug 2017 18:14:31 +0000</pubDate>
		<guid isPermaLink="false">/?p=3058#comment-461775</guid>
		<description><![CDATA[I need algorithm for finding day when user enter date month]]></description>
		<content:encoded><![CDATA[<p>I need algorithm for finding day when user enter date month</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>/2012/04/24/computer-algorithms-how-to-determine-the-day-of-the-week/comment-page-1/#comment-411418</link>
		<dc:creator><![CDATA[Mike]]></dc:creator>
		<pubDate>Sat, 18 Jun 2016 17:58:01 +0000</pubDate>
		<guid isPermaLink="false">/?p=3058#comment-411418</guid>
		<description><![CDATA[The century number can also be caclulated as follows:
$century  = 6 - (y / 100) % 4 * 2]]></description>
		<content:encoded><![CDATA[<p>The century number can also be caclulated as follows:<br />
$century  = 6 &#8211; (y / 100) % 4 * 2</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>/2012/04/24/computer-algorithms-how-to-determine-the-day-of-the-week/comment-page-1/#comment-398434</link>
		<dc:creator><![CDATA[Chris]]></dc:creator>
		<pubDate>Fri, 26 Feb 2016 15:42:33 +0000</pubDate>
		<guid isPermaLink="false">/?p=3058#comment-398434</guid>
		<description><![CDATA[Juan is correct.  Add the date to the result of step 5 before doing step 6, and it works.]]></description>
		<content:encoded><![CDATA[<p>Juan is correct.  Add the date to the result of step 5 before doing step 6, and it works.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JUan Tamad</title>
		<link>/2012/04/24/computer-algorithms-how-to-determine-the-day-of-the-week/comment-page-1/#comment-350872</link>
		<dc:creator><![CDATA[JUan Tamad]]></dc:creator>
		<pubDate>Fri, 21 Aug 2015 07:40:47 +0000</pubDate>
		<guid isPermaLink="false">/?p=3058#comment-350872</guid>
		<description><![CDATA[It is faulty since it does not consider  the &#039; 31&#039;]]></description>
		<content:encoded><![CDATA[<p>It is faulty since it does not consider  the &#8216; 31&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Julian Bliss</title>
		<link>/2012/04/24/computer-algorithms-how-to-determine-the-day-of-the-week/comment-page-1/#comment-22219</link>
		<dc:creator><![CDATA[Julian Bliss]]></dc:creator>
		<pubDate>Tue, 15 Apr 2014 21:16:04 +0000</pubDate>
		<guid isPermaLink="false">/?p=3058#comment-22219</guid>
		<description><![CDATA[Indeed the algorithm is faulty. The problem is the day of the week isn&#039;t added. Simply add the day in Step 5, in this case 31. Then after the mod is applied, it will be correct.]]></description>
		<content:encoded><![CDATA[<p>Indeed the algorithm is faulty. The problem is the day of the week isn&#8217;t added. Simply add the day in Step 5, in this case 31. Then after the mod is applied, it will be correct.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: None Provided</title>
		<link>/2012/04/24/computer-algorithms-how-to-determine-the-day-of-the-week/comment-page-1/#comment-18578</link>
		<dc:creator><![CDATA[None Provided]]></dc:creator>
		<pubDate>Tue, 02 Apr 2013 02:00:03 +0000</pubDate>
		<guid isPermaLink="false">/?p=3058#comment-18578</guid>
		<description><![CDATA[Ummm - is this posting a joke?

The algorithm doesn&#039;t work, even for your example walk-through.
January 31, 1883 was a Wednesday, not a Sunday.]]></description>
		<content:encoded><![CDATA[<p>Ummm &#8211; is this posting a joke?</p>
<p>The algorithm doesn&#8217;t work, even for your example walk-through.<br />
January 31, 1883 was a Wednesday, not a Sunday.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
