<?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>Amit Yadav &#187; Technology</title>
	<atom:link href="http://www.amityadav.name/tag/technology/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.amityadav.name</link>
	<description>Things to know for effective coding</description>
	<lastBuildDate>Fri, 19 Aug 2011 17:51:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Google Instant</title>
		<link>http://www.amityadav.name/google-instant/</link>
		<comments>http://www.amityadav.name/google-instant/#comments</comments>
		<pubDate>Thu, 09 Sep 2010 11:06:00 +0000</pubDate>
		<dc:creator>Amit</dc:creator>
				<category><![CDATA[Internet News]]></category>
		<category><![CDATA[Companies]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[Google Search]]></category>
		<category><![CDATA[Googleinstant]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[search engine]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web search engine]]></category>

		<guid isPermaLink="false">http://www.amityadav.name/?p=656</guid>
		<description><![CDATA[Google will be rolling out the new Google Instant over several days. Google Instant is an enhancement to the Google Search that shows results as you type. With Google Instant users will be getting instant &#38; faster search results. The thinking behind Google Instant is that the research shows that people type slowly and scan [...]]]></description>
			<content:encoded><![CDATA[<p><a class="zem_slink" title="Google" rel="homepage" href="http://google.com">Google</a> will be rolling out the new Google Instant over several days.</p>
<p>Google Instant is an enhancement to the Google Search that shows results as you type. With Google Instant users will be getting instant &amp; faster search results. The thinking behind Google Instant is that the <a class="zem_slink" title="Research" rel="wikipedia" href="http://en.wikipedia.org/wiki/Research">research</a> shows that people type slowly and scan fast, so while the users are typing they can scan the results shown and choose the most appropriate out of that.</p>
<div class="img alignleft size-medium wp-image-667" style="width:300px;">
	<a href="http://www.amityadav.name/wp-content/uploads/2010/09/google_instant.png"><img src="http://www.amityadav.name/wp-content/uploads/2010/09/google_instant-300x243.png" alt="" width="300" height="243" /></a>
	<div>google_instant</div>
</div>
<p style="padding-left: 180px;">The most obvious change is that users get to the right content much faster than before because one don’t have to finish typing your full search term, or even press “search.” This has been there in various <a class="zem_slink" title="Web search engine" rel="wikipedia" href="http://en.wikipedia.org/wiki/Web_search_engine">search engines</a> and many others are using this from a long time.</p>
<p style="padding-left: 180px;">The benefits to this is that the users get instant, faster and more accurate search results. This will certainly help users in searching and most of all choosing the right keyword to get appropriate results.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/pixy.gif?x-id=7ccaf0de-2c8c-4a49-8f36-5c5359c801c8" alt="" /><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.amityadav.name%2Fgoogle-instant%2F&amp;title=Google%20Instant" id="wpa2a_2"><img src="http://www.amityadav.name/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.amityadav.name/google-instant/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Custom DateFiff Function</title>
		<link>http://www.amityadav.name/php-custom-datefiff-function/</link>
		<comments>http://www.amityadav.name/php-custom-datefiff-function/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 11:04:58 +0000</pubDate>
		<dc:creator>Amit</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Integers]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[Recreation]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.amityadav.name/?p=345</guid>
		<description><![CDATA[?View Code PHP1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p345code3'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3453"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
</pre></td><td class="code" id="p345code3"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> datediff<span style="color: #009900;">&#40;</span><span style="color: #000088;">$interval</span><span style="color: #339933;">,</span> <span style="color: #000088;">$datefrom</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dateto</span><span style="color: #339933;">,</span> <span style="color: #000088;">$using_timestamps</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">/*
    $interval can be:
    yyyy - Number of full years
    q - Number of full quarters
    m - Number of full months
    y - Difference between day numbers
      (eg 1st Jan 2004 is &quot;1&quot;, the first day. 2nd Feb 2003 is &quot;33&quot;. The datediff is &quot;-32&quot;.)
    d - Number of full days
    w - Number of full weekdays
    ww - Number of full weeks
    h - Number of full hours
    n - Number of full minutes
    s - Number of full seconds (default)
  */</span>
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$using_timestamps</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$datefrom</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/strtotime"><span style="color: #990000;">strtotime</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$datefrom</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$dateto</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/strtotime"><span style="color: #990000;">strtotime</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dateto</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000088;">$difference</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$dateto</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$datefrom</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Difference in seconds</span>
&nbsp;
  <span style="color: #b1b100;">switch</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$interval</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'yyyy'</span><span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Number of full years</span>
      <span style="color: #000088;">$years_difference</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/floor"><span style="color: #990000;">floor</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$difference</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">31536000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/mktime"><span style="color: #990000;">mktime</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;H&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$datefrom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;i&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$datefrom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;s&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$datefrom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;n&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$datefrom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;j&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$datefrom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Y&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$datefrom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #000088;">$years_difference</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #000088;">$dateto</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$years_difference</span><span style="color: #339933;">--;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/mktime"><span style="color: #990000;">mktime</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;H&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dateto</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;i&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dateto</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;s&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dateto</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;n&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dateto</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;j&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dateto</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Y&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dateto</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$years_difference</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #000088;">$datefrom</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$years_difference</span><span style="color: #339933;">++;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #000088;">$datediff</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$years_difference</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;q&quot;</span><span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Number of full quarters</span>
      <span style="color: #000088;">$quarters_difference</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/floor"><span style="color: #990000;">floor</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$difference</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">8035200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/mktime"><span style="color: #990000;">mktime</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;H&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$datefrom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;i&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$datefrom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;s&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$datefrom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;n&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$datefrom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$quarters_difference</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;j&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dateto</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Y&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$datefrom</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #000088;">$dateto</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$months_difference</span><span style="color: #339933;">++;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #000088;">$quarters_difference</span><span style="color: #339933;">--;</span>
      <span style="color: #000088;">$datediff</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$quarters_difference</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;m&quot;</span><span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Number of full months</span>
      <span style="color: #000088;">$months_difference</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/floor"><span style="color: #990000;">floor</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$difference</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">2678400</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/mktime"><span style="color: #990000;">mktime</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;H&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$datefrom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;i&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$datefrom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;s&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$datefrom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;n&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$datefrom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$months_difference</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;j&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dateto</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Y&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$datefrom</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #000088;">$dateto</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$months_difference</span><span style="color: #339933;">++;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #000088;">$months_difference</span><span style="color: #339933;">--;</span>
      <span style="color: #000088;">$datediff</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$months_difference</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'y'</span><span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Difference between day numbers</span>
      <span style="color: #000088;">$datediff</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;z&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dateto</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;z&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$datefrom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;d&quot;</span><span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Number of full days</span>
      <span style="color: #000088;">$datediff</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/floor"><span style="color: #990000;">floor</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$difference</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">86400</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;w&quot;</span><span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Number of full weekdays</span>
      <span style="color: #000088;">$days_difference</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/floor"><span style="color: #990000;">floor</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$difference</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">86400</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$weeks_difference</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/floor"><span style="color: #990000;">floor</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$days_difference</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">7</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Complete weeks</span>
      <span style="color: #000088;">$first_day</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;w&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$datefrom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$days_remainder</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/floor"><span style="color: #990000;">floor</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$days_difference</span> <span style="color: #339933;">%</span> <span style="color: #cc66cc;">7</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$odd_days</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$first_day</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$days_remainder</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Do we have a Saturday or Sunday in the remainder?</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$odd_days</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">7</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// Sunday</span>
        <span style="color: #000088;">$days_remainder</span><span style="color: #339933;">--;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$odd_days</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">6</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// Saturday</span>
        <span style="color: #000088;">$days_remainder</span><span style="color: #339933;">--;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #000088;">$datediff</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$weeks_difference</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$days_remainder</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;ww&quot;</span><span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Number of full weeks</span>
      <span style="color: #000088;">$datediff</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/floor"><span style="color: #990000;">floor</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$difference</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">604800</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;h&quot;</span><span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Number of full hours</span>
      <span style="color: #000088;">$datediff</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/floor"><span style="color: #990000;">floor</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$difference</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">3600</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;n&quot;</span><span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Number of full minutes</span>
      <span style="color: #000088;">$datediff</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/floor"><span style="color: #990000;">floor</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$difference</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">60</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">default</span><span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// Number of full seconds (default)</span>
      <span style="color: #000088;">$datediff</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$difference</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>   
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$datediff</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Usage:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p345code4'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3454"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p345code4"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> datediff<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'w'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'9 July 2003'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'4 March 2004'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<div class="zemanta-pixie" style="margin-top:10px;height:15px"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=160968f3-666b-495f-a90f-74a2515550a9" style="border:none;float:right"><span class="zem-script more-related pretty-attribution"><script type="text/javascript" src="http://static.zemanta.com/readside/loader.js" defer="defer"></script></span></div>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.amityadav.name%2Fphp-custom-datefiff-function%2F&amp;title=PHP%20Custom%20DateFiff%20Function" id="wpa2a_4"><img src="http://www.amityadav.name/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.amityadav.name/php-custom-datefiff-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interesting interview that i came across!</title>
		<link>http://www.amityadav.name/interesting-interview-that-i-came-across/</link>
		<comments>http://www.amityadav.name/interesting-interview-that-i-came-across/#comments</comments>
		<pubDate>Mon, 24 Mar 2008 04:54:46 +0000</pubDate>
		<dc:creator>Amit</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://www.amityadav.name/?p=5</guid>
		<description><![CDATA[While going through Rajesh Jain&#8217;s blog &#8220;http://emergic.org/&#8221;, i came across a nice interview with Rajesh Jain. Rajesh Jain is known as the man who almost single handedly brought on the dotcom boom to India after selling off his Internet venture, IndiaWorld.com, to Satyam for Rs 499 crore in 1999. He is, in effect, the first [...]]]></description>
			<content:encoded><![CDATA[<p>While going through Rajesh Jain&#8217;s blog &#8220;http://emergic.org/&#8221;, i came across a nice interview with Rajesh Jain.</p>
<p><font class="redheadline1">Rajesh Jain</font> is known as the man who almost single handedly brought on the dotcom boom to India after selling off his Internet venture, IndiaWorld.com, to Satyam for Rs 499 crore in 1999. He is, in effect, the first dotcom multi-millionaire that India produced.</p>
<p><a href="http://digital.agencyfaqs.com/perl/digital/voices/digichat/index.html?id=19" target="_blank" title="A nice interview with Rajesh Jain">Here is the full interview&#8230;</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.amityadav.name%2Finteresting-interview-that-i-came-across%2F&amp;title=Interesting%20interview%20that%20i%20came%20across%21" id="wpa2a_6"><img src="http://www.amityadav.name/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.amityadav.name/interesting-interview-that-i-came-across/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

