<?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 date differences</title>
	<atom:link href="http://sniptools.com/vault/calculating-date-differences/feed" rel="self" type="application/rss+xml" />
	<link>http://sniptools.com/vault/calculating-date-differences</link>
	<description>Design &#38; Technology Observations</description>
	<lastBuildDate>Thu, 12 Jan 2012 08:01:17 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: John H</title>
		<link>http://sniptools.com/vault/calculating-date-differences#comment-2403</link>
		<dc:creator>John H</dc:creator>
		<pubDate>Sun, 12 Apr 2009 19:59:53 +0000</pubDate>
		<guid isPermaLink="false">http://sniptools.com/cms/?p=24#comment-2403</guid>
		<description>Thanks for posting this example.

I used it as a basis to calculate the difference in weeks, days, hours and minutes between two Unix date stamps.

$diff = $end_date - $start_date;
$weeks = floor($diff/60/60/24/7);
echo &quot;Weeks Difference  = &quot;. $weeks;
$diff -= $weeks ? $weeks * (60*60*24*7) : 0;
$days = floor($diff/60/60/24);
echo &quot;Days Difference    = &quot;. $days;
$diff -= $days ? $days * (60*60*24) : $difference;
$hours = floor($difference/60/60);
echo &quot;Hours Difference   = &quot;. $hours;
$difference -= $hours ? $hours * (60*60) : $difference;
$minutes = floor($difference/60);
echo &quot;Minutes Difference = &quot;. $minutes;</description>
		<content:encoded><![CDATA[<p>Thanks for posting this example.</p>
<p>I used it as a basis to calculate the difference in weeks, days, hours and minutes between two Unix date stamps.</p>
<p>$diff = $end_date — $start_date;<br />
$weeks = floor($diff/60/60/24/7);<br />
echo "Weeks Difference  = ". $weeks;<br />
$diff -= $weeks ? $weeks * (60*60*24*7) : 0;<br />
$days = floor($diff/60/60/24);<br />
echo "Days Difference    = ". $days;<br />
$diff -= $days ? $days * (60*60*24) : $difference;<br />
$hours = floor($difference/60/60);<br />
echo "Hours Difference   = ". $hours;<br />
$difference -= $hours ? $hours * (60*60) : $difference;<br />
$minutes = floor($difference/60);<br />
echo "Minutes Difference = ". $minutes;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: murry</title>
		<link>http://sniptools.com/vault/calculating-date-differences#comment-814</link>
		<dc:creator>murry</dc:creator>
		<pubDate>Sun, 02 Dec 2007 21:00:48 +0000</pubDate>
		<guid isPermaLink="false">http://sniptools.com/cms/?p=24#comment-814</guid>
		<description>how to get the age from date of birth and todays date in access 2003

plz give answer as soon as possible
</description>
		<content:encoded><![CDATA[<p>how to get the age from date of birth and todays date in access 2003</p>
<p>plz give answer as soon as possible</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alan</title>
		<link>http://sniptools.com/vault/calculating-date-differences#comment-813</link>
		<dc:creator>Alan</dc:creator>
		<pubDate>Wed, 05 Sep 2007 19:49:38 +0000</pubDate>
		<guid isPermaLink="false">http://sniptools.com/cms/?p=24#comment-813</guid>
		<description>Will someone please help me in writing the Pl/SQL code.. I wanna a code....
I want to calculate the number of days between the two dates provided.
</description>
		<content:encoded><![CDATA[<p>Will someone please help me in writing the Pl/SQL code.. I wanna a code.…<br />
I want to calculate the number of days between the two dates provided.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mika Lim</title>
		<link>http://sniptools.com/vault/calculating-date-differences#comment-812</link>
		<dc:creator>Mika Lim</dc:creator>
		<pubDate>Mon, 13 Feb 2006 17:27:34 +0000</pubDate>
		<guid isPermaLink="false">http://sniptools.com/cms/?p=24#comment-812</guid>
		<description>The code is look like easy and useful, but the mktime() function only can support between 2 January 1970 until
18 January 2038, may be this is a limitation for unix date format. So anyone can be solve this problem?
</description>
		<content:encoded><![CDATA[<p>The code is look like easy and useful, but the mktime() function only can support between 2 January 1970 until<br />
18 January 2038, may be this is a limitation for unix date format. So anyone can be solve this problem?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sniptools</title>
		<link>http://sniptools.com/vault/calculating-date-differences#comment-811</link>
		<dc:creator>sniptools</dc:creator>
		<pubDate>Fri, 19 Aug 2005 17:21:05 +0000</pubDate>
		<guid isPermaLink="false">http://sniptools.com/cms/?p=24#comment-811</guid>
		<description>Hi Adams,

You mention &quot;dual&quot; so I will assume you are working with Oracle.

Let me think of a more graceful way, but you should be able to achieve what you need with case statements in Oracle&#039;s PL/SQL. E.g.,

SELECT
case when date2 is null then date 1
when date1 is null then date2
else date1-date2
end
FROM dual;

Or something like that, hope that gets you started on the right track.
</description>
		<content:encoded><![CDATA[<p>Hi Adams,</p>
<p>You mention "dual" so I will assume you are working with Oracle.</p>
<p>Let me think of a more graceful way, but you should be able to achieve what you need with case statements in Oracle's PL/SQL. E.g.,</p>
<p>SELECT<br />
case when date2 is null then date 1<br />
when date1 is null then date2<br />
else date1-date2<br />
end<br />
FROM dual;</p>
<p>Or something like that, hope that gets you started on the right track.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adams</title>
		<link>http://sniptools.com/vault/calculating-date-differences#comment-810</link>
		<dc:creator>adams</dc:creator>
		<pubDate>Fri, 19 Aug 2005 16:18:30 +0000</pubDate>
		<guid isPermaLink="false">http://sniptools.com/cms/?p=24#comment-810</guid>
		<description>How does one calculate difference of two dates when one of the two dates is null ?

eg. select date1-date2 from dual;

Here if date2 is null, how do we manage to calculate the difference ? Same if date1 contains a null value ?
</description>
		<content:encoded><![CDATA[<p>How does one calculate difference of two dates when one of the two dates is null ?</p>
<p>eg. select date1-date2 from dual;</p>
<p>Here if date2 is null, how do we manage to calculate the difference ? Same if date1 contains a null value ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: soso</title>
		<link>http://sniptools.com/vault/calculating-date-differences#comment-809</link>
		<dc:creator>soso</dc:creator>
		<pubDate>Tue, 26 Apr 2005 14:42:05 +0000</pubDate>
		<guid isPermaLink="false">http://sniptools.com/cms/?p=24#comment-809</guid>
		<description>To find number of days, round() would be better than floor() i think. For dates including a summer or winter hour change (i.e. march). i had this problem on php/windows.
</description>
		<content:encoded><![CDATA[<p>To find number of days, round() would be better than floor() i think. For dates including a summer or winter hour change (i.e. march). i had this problem on php/windows.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nagesh</title>
		<link>http://sniptools.com/vault/calculating-date-differences#comment-808</link>
		<dc:creator>nagesh</dc:creator>
		<pubDate>Tue, 29 Mar 2005 06:16:18 +0000</pubDate>
		<guid isPermaLink="false">http://sniptools.com/cms/?p=24#comment-808</guid>
		<description>i want to replace the null value in date column while writing to a file with an empty space with out changing the type of column
</description>
		<content:encoded><![CDATA[<p>i want to replace the null value in date column while writing to a file with an empty space with out changing the type of column</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dharm Shankar</title>
		<link>http://sniptools.com/vault/calculating-date-differences#comment-807</link>
		<dc:creator>Dharm Shankar</dc:creator>
		<pubDate>Mon, 24 Jan 2005 22:34:05 +0000</pubDate>
		<guid isPermaLink="false">http://sniptools.com/cms/?p=24#comment-807</guid>
		<description>Had u checked with 2038 and above?
</description>
		<content:encoded><![CDATA[<p>Had u checked with 2038 and above?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rama</title>
		<link>http://sniptools.com/vault/calculating-date-differences#comment-806</link>
		<dc:creator>Rama</dc:creator>
		<pubDate>Wed, 22 Dec 2004 00:37:51 +0000</pubDate>
		<guid isPermaLink="false">http://sniptools.com/cms/?p=24#comment-806</guid>
		<description>Thank u very much, u made my work very simple(in php getting the days difference between dates).
</description>
		<content:encoded><![CDATA[<p>Thank u very much, u made my work very simple(in php getting the days difference between dates).</p>
]]></content:encoded>
	</item>
</channel>
</rss>

