<?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>TechnoBlogy &#187; date</title>
	<atom:link href="http://technoblogy.net/tag/date/feed/" rel="self" type="application/rss+xml" />
	<link>http://technoblogy.net</link>
	<description>Technology with a Big difference</description>
	<lastBuildDate>Mon, 05 Dec 2011 17:29:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Date Time string formatting in ASP.NET</title>
		<link>http://technoblogy.net/date-time-string-formatting-in-asp-net/</link>
		<comments>http://technoblogy.net/date-time-string-formatting-in-asp-net/#comments</comments>
		<pubDate>Thu, 24 Dec 2009 11:15:15 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[DateTime]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[string formatting]]></category>

		<guid isPermaLink="false">http://technoblogy.net/date-time-string-formatting-in-asp-net/</guid>
		<description><![CDATA[With the following code you can format a DateTime within a Databind. &#60;%# DateTime.Parse(Eval(&#34;DateModified&#34;).ToString()).ToString(&#34;MM-dd-yyyy&#34;)%&#62; Some more format specifiers that can change format of datetime objects the way it is required. Format specifier Name d Short date pattern D Long date pattern t Short time pattern T Long time pattern f Full date/time pattern ( short [...]]]></description>
			<content:encoded><![CDATA[<p>With the following code you can format a DateTime within a Databind.</p>
<blockquote><p>&lt;%# DateTime.Parse(Eval(&quot;DateModified&quot;).ToString()).ToString(&quot;MM-dd-yyyy&quot;)%&gt; </p>
</blockquote>
<p>Some more format specifiers that can change format of datetime objects the way it is required.</p>
<table class="data" cellspacing="1" width="50%" align="left">
<colgroup>
<col width="20%" />
<col width="25%" /></colgroup>
<tbody>
<tr>
<th>Format specifier</th>
<th>Name</th>
</tr>
<tr>
<td>d</td>
<td>Short date pattern</td>
</tr>
<tr>
<td>D</td>
<td>Long date pattern</td>
</tr>
<tr>
<td>t</td>
<td>Short time pattern</td>
</tr>
<tr>
<td>T</td>
<td>Long time pattern</td>
</tr>
<tr>
<td>f</td>
<td>Full date/time pattern ( short time )</td>
</tr>
<tr>
<td>F</td>
<td>Full date/time pattern ( long time )</td>
</tr>
<tr>
<td>g</td>
<td>General date/time pattern ( short time )</td>
</tr>
<tr>
<td>G</td>
<td>General date/time pattern ( long time )</td>
</tr>
<tr>
<td>M or m</td>
<td>Month day pattern</td>
</tr>
<tr>
<td>R or r</td>
<td>RFC1123 pattern</td>
</tr>
<tr>
<td>s</td>
<td>Sortable date/time pattern; conforms to ISO 8601</td>
</tr>
<tr>
<td>u</td>
<td>Universal sortable date/time pattern</td>
</tr>
<tr>
<td>U</td>
<td>Universal sortable date/time pattern</td>
</tr>
<tr>
<td>Y or y</td>
<td>Year month pattern</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/date-time-string-formatting-in-asp-net/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Calculating difference of dates in Oracle</title>
		<link>http://technoblogy.net/calculating-difference-of-dates-in-oracle/</link>
		<comments>http://technoblogy.net/calculating-difference-of-dates-in-oracle/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 16:28:37 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[datediff]]></category>
		<category><![CDATA[difference]]></category>
		<category><![CDATA[subtraction]]></category>

		<guid isPermaLink="false">http://technoblogy.net/calculating-difference-of-dates-in-oracle/</guid>
		<description><![CDATA[How to calculate difference between two dates in oracle, as subtraction of dates returns numeric value as difference. With some slight changes/enhancements we can track back the subtraction values to some readable date formats: Here are some examples, these can also be amended for user convenience: SQL&#62; SELECT floor(((date1-date2)*24*60*60)/3600) 2 &#124;&#124; ' HOURS ' &#124;&#124; [...]]]></description>
			<content:encoded><![CDATA[<p>How to calculate difference between two dates in oracle, as subtraction of dates returns numeric value as difference. With some slight changes/enhancements we can track back the subtraction values to some readable date formats:</p>
<p>Here are some examples, these can also be amended for user convenience:</p>
<blockquote><pre>SQL&gt; SELECT floor(((date1-date2)*24*60*60)/3600)
  2         || ' HOURS ' ||
  3         floor((((date1-date2)*24*60*60) -
  4         floor(((date1-date2)*24*60*60)/3600)*3600)/60)
  5         || ' MINUTES ' ||
  6         round((((date1-date2)*24*60*60) -
  7         floor(((date1-date2)*24*60*60)/3600)*3600 -
  8         (floor((((date1-date2)*24*60*60) -
  9         floor(((date1-date2)*24*60*60)/3600)*3600)/60)*60) ))
 10         || ' SECS ' time_difference
 11    FROM dates;

TIME_DIFFERENCE
--------------------------------------------------------------------------------
24 HOURS 0 MINUTES 0 SECS
1 HOURS 0 MINUTES 0 SECS
0 HOURS 1 MINUTES 0 SECS</pre>
</blockquote>
<blockquote><pre>SQL&gt; SELECT to_number( to_char(to_date('1','J') +
  2         (date1 - date2), 'J') - 1)  days,
  3         to_char(to_date('00:00:00','HH24:MI:SS') +
  4         (date1 - date2), 'HH24:MI:SS') time
  5   FROM dates;

      DAYS TIME
---------- --------
         1 00:00:00
         0 01:00:00
         0 00:01:00</pre>
</blockquote>
<blockquote><pre>SQL&gt; select numtodsinterval(date1-date2,'day') time_difference from dates;

TIME_DIFFERENCE
----------------------------------------------------------------
+000000001 00:00:00.000000000
+000000000 01:00:00.000000000
+000000000 00:01:00.000000000</pre>
</blockquote>
<blockquote><pre>SQL&gt; SELECT floor((date1-date2)*24)
  2         || ' HOURS ' ||
  3         mod(floor((date1-date2)*24*60),60)
  5         || ' MINUTES ' ||
  6         mod(floor((date1-date2)*24*60*60),60)
 10         || ' SECS ' time_difference
 11    FROM dates;

TIME_DIFFERENCE
--------------------------------------------------------------------------------
24 HOURS 0 MINUTES 0 SECS
1 HOURS 0 MINUTES 0 SECS
0 HOURS 1 MINUTES 0 SECS</pre>
</blockquote>
<pre>&nbsp;</pre>
<blockquote></blockquote>
<pre>&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/calculating-difference-of-dates-in-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find week start/end given week number</title>
		<link>http://technoblogy.net/find-week-startend-given-week-number/</link>
		<comments>http://technoblogy.net/find-week-startend-given-week-number/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 14:32:43 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[datediff]]></category>
		<category><![CDATA[date_add]]></category>
		<category><![CDATA[week]]></category>

		<guid isPermaLink="false">http://technoblogy.net/find-week-startend-given-week-number/</guid>
		<description><![CDATA[I have a table with some dated records. I wanted to do some weekly reports on this data. MySQL has a nifty function dubbed WEEK() which will return a week number. It allows you to break your data into week long intervals very easily. For example, the following query will tell me how many records [...]]]></description>
			<content:encoded><![CDATA[<p>I have a table with some dated records. I wanted to do some weekly reports on this data. MySQL has a nifty function dubbed <kbd>WEEK()</kbd> which will return a <em>week number</em>. It allows you to break your data into week long intervals very easily. For example, the following query will tell me how many records came in each week:</p>
<blockquote><p>SELECT COUNT(*), WEEK(mydate) </p>
<p>FROM mytable </p>
<p>GROUP BY WEEK(mydate);</p>
</blockquote>
<p>The problem here is, that the output is totally meaningless to me as I do not have a clue what does week 36 mean. What I really want is to have on the screen is a nice, human readable date interval &#8211; the beginning and ending date of any given week.</p>
<p>Surprisingly, this turns out the be a major pain in the ass. There is no simple function that will yield a week interval (or start/end date of a week) given a week number. You have to find these dates manually. Here is how I did it:</p>
<blockquote><p>SELECT COUNT(*) AS reports_in_week, DATE_ADD(mydate, INTERVAL( 1-DAYOFWEEK(mydate) ) DAY), DATE_ADD(mydate, INTERVAL( 7-DAYOFWEEK(mydate) ) DAY) </p>
<p>FROM mytable </p>
<p>GROUP BY WEEK(mydate)</p>
</blockquote>
<p>How does it work? The <kbd>DAYOFWEEK()</kbd> function returns an integer ranging from 1 (Sunday) to 7 (Saturday). So if <kbd>mydate</kbd> happens to be Tuesday we get the following statements:</p>
<blockquote><p>DATE_ADD(mydate, INTERVAL -2 DAY)</p>
</blockquote>
<p>which essentially means <em>&quot;subtract 2 days from mydate</em> (which is that week&#8217;s Sunday) and also:</p>
<blockquote><p>DATE_ADD(mydate, INTERVAL 4 DAY)</p>
</blockquote>
<p>which yields the date of that week&#8217;s Friday.</p>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/find-week-startend-given-week-number/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Calculate the Number of Week Days Between two Dates</title>
		<link>http://technoblogy.net/how-to-calculate-the-number-of-week-days-between-two-dates/</link>
		<comments>http://technoblogy.net/how-to-calculate-the-number-of-week-days-between-two-dates/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 16:16:21 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[datediff]]></category>
		<category><![CDATA[week]]></category>

		<guid isPermaLink="false">http://technoblogy.net/how-to-calculate-the-number-of-week-days-between-two-dates/</guid>
		<description><![CDATA[If the start date and end date are both week days, then the total number of week days in between is simply: (total difference in days) &#8211; (total difference in weeks) * 2 DateDiff(dd, @start, @end) &#8211; DateDiff(ww, @start, @end)*2 &#8230; since the DateDiff() function with weeks returns the number of week &#34;boundaries&#34; that are [...]]]></description>
			<content:encoded><![CDATA[<p>If the start date and end date are both week days, then the total number of week days in between is simply: </p>
<blockquote><p>(total difference in days) &#8211; (total difference in weeks) * 2</p>
</blockquote>
<blockquote><p>DateDiff(dd, @start, @end) &#8211; DateDiff(ww, @start, @end)*2</p>
</blockquote>
<p>&#8230; since the DateDiff() function with weeks returns the number of week &quot;boundaries&quot; that are crossed; i.e., the number of weekends.    <br />If you have a table of holidays, then you can simply subtract them out as well: </p>
<blockquote><p>DateDiff(dd, @start, @end) &#8211;      <br />DateDiff(ww, @start, @end)*2 &#8211;       <br />(select count(*) from holidays where holiday_date between @start and @end)</p>
</blockquote>
<p>Now, what if the start day or the end day is on a weekend? In that case, you need to define what to do in those situations in your requirements.    <br />For example, if the start date is Sunday, Nov 20th, and the end day is Monday, Nov 21st &#8212; how many week days are between those dates? There&#8217;s no universal correct answer; it could be 0, or 1, or perhaps even &quot;undefined&quot; (null) depending on your needs.</p>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/how-to-calculate-the-number-of-week-days-between-two-dates/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

