<?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>Lost within &#187; php</title>
	<atom:link href="http://lostwithin.net/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostwithin.net</link>
	<description>Alaa Abdelhaq Blog</description>
	<lastBuildDate>Mon, 20 Feb 2012 11:14:08 +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>How to manipulate mysql datetime using php</title>
		<link>http://lostwithin.net/how-to-manipulate-mysql-datetime-using-php/</link>
		<comments>http://lostwithin.net/how-to-manipulate-mysql-datetime-using-php/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 09:04:25 +0000</pubDate>
		<dc:creator>Alaa Abdelhaq</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[add]]></category>
		<category><![CDATA[datetime]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[manipulate]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://lostwithin.net/?p=91</guid>
		<description><![CDATA[You are having hard time with mysql datetime format? I wont blame you I hope this short example will help you. let say in your mysql database you are saving time on the datetime format like this &#8220;2009-01-20 02:11:05&#8243;. you need to pull it and add some days or time intervals and print it in [...]]]></description>
			<content:encoded><![CDATA[<p>You are having hard time with mysql datetime format? I wont blame you <img src='http://lostwithin.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
I hope this short example will help you.</p>
<p>let say in your mysql database you are saving time on the datetime format<br />
like this &#8220;2009-01-20 02:11:05&#8243;.</p>
<p>you need to pull it and add some days or time intervals and print it in a different format, thats easy do the following</p>
<p>1- In your query pulling the time, pull it this way:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #000099;">UNIX_TIMESTAMP</span><span style="color: #FF00FF;">&#40;</span><span style="color: #999900; font-weight: bold;">time</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">AS</span> <span style="color: #999900; font-weight: bold;">time</span></pre></div></div>

<p>this will covert it into unix timestamp, which will make it easier for you to manipulate it with php functions.</p>
<p>2- Add your time interval, let say we need to add 15 days.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$unix_timestamp_from_database</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1232410265</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$time_from_db</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$unix_timestamp_from_database</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$new_time</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$time_from_db</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">15</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">86400</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>86400seconds equals one day.<br />
In unix timestamp we manipulate time by seconds.<br />
so if you want to add an hour you add it like by (60 * 60)<br />
which equals 3600 seconds.</p>
<p>3- Then you format it as you desire:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$new_time_format</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;d-M-Y&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$new_time</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$new_time_format</span><span style="color: #339933;">;</span></pre></div></div>

<p>hope it will help you <img src='http://lostwithin.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://lostwithin.net/how-to-manipulate-mysql-datetime-using-php/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Ubuntu &#8211; Enable mod_rewrite in Apache server</title>
		<link>http://lostwithin.net/ubuntu-enable-mod_rewrite-in-apache-server/</link>
		<comments>http://lostwithin.net/ubuntu-enable-mod_rewrite-in-apache-server/#comments</comments>
		<pubDate>Sun, 17 Aug 2008 07:59:58 +0000</pubDate>
		<dc:creator>Alaa Abdelhaq</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mode rewrite]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://lostwithin.net/?p=20</guid>
		<description><![CDATA[At first I should define, what is mod_rewrite? mod_rewrite is a part of Apache server that can rewrite requested urls on the fly. To enable mod_rewrite in Ubuntu, you just need to write this command in terminal sudo a2enmod rewrite]]></description>
			<content:encoded><![CDATA[<p>At first I should define, what is mod_rewrite?<br />
mod_rewrite is a part of Apache server that can rewrite requested urls on the fly.</p>
<p>To enable mod_rewrite in Ubuntu, you just need to write this command in terminal</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> a2enmod rewrite</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://lostwithin.net/ubuntu-enable-mod_rewrite-in-apache-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

