<?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: UNIX timestamp to Oracle Date Conversion</title>
	<atom:link href="http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/</link>
	<description>because I don't believe in life before coffee...</description>
	<lastBuildDate>Wed, 28 Oct 2009 06:44:36 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Hedgehog</title>
		<link>http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/comment-page-1/#comment-369711</link>
		<dc:creator>Hedgehog</dc:creator>
		<pubDate>Tue, 05 Aug 2008 21:23:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/#comment-369711</guid>
		<description>What to do if my timestamps are bigger that 32-bit format e.g. 1026259200000 for date 2002-07-10 (yyyy-MM-dd)? If I cut last free 0 I&#039;m getting correct date. But how can be sure when to cut them and when not?</description>
		<content:encoded><![CDATA[<p>What to do if my timestamps are bigger that 32-bit format e.g. 1026259200000 for date 2002-07-10 (yyyy-MM-dd)? If I cut last free 0 I&#8217;m getting correct date. But how can be sure when to cut them and when not?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon</title>
		<link>http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/comment-page-1/#comment-2222</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Sun, 25 Jun 2006 14:47:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/#comment-2222</guid>
		<description>Yup, Mike&#039;s query does the same thing my function does, just without error handling.  Nice for a one-off but if you need this often it&#039;s handy to have the function around.

Jon</description>
		<content:encoded><![CDATA[<p>Yup, Mike&#8217;s query does the same thing my function does, just without error handling.  Nice for a one-off but if you need this often it&#8217;s handy to have the function around.</p>
<p>Jon</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mike</title>
		<link>http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/comment-page-1/#comment-2201</link>
		<dc:creator>mike</dc:creator>
		<pubDate>Sat, 24 Jun 2006 16:45:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/#comment-2201</guid>
		<description>This query converts UNIX to Oracle and handles the time zones. Add TO_CHAR to format the date, if required. 

select trunc((timestamp &#039;1970-01-01 00:00:00 GMT&#039; + numtodsinterval(1094165422, &#039;SECOND&#039;)) at time zone &#039;Canada/Pacific&#039;) at_time_zone_date 
from dual</description>
		<content:encoded><![CDATA[<p>This query converts UNIX to Oracle and handles the time zones. Add TO_CHAR to format the date, if required. </p>
<p>select trunc((timestamp &#8216;1970-01-01 00:00:00 GMT&#8217; + numtodsinterval(1094165422, &#8216;SECOND&#8217;)) at time zone &#8216;Canada/Pacific&#8217;) at_time_zone_date<br />
from dual</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anthony Ettinger</title>
		<link>http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/comment-page-1/#comment-961</link>
		<dc:creator>Anthony Ettinger</dc:creator>
		<pubDate>Tue, 23 May 2006 21:07:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/#comment-961</guid>
		<description>you saved my day...i was ready to bang my head against the screeen.

#version 8.1.7x

oracle_date := unix_epoch + (unixts/86400);</description>
		<content:encoded><![CDATA[<p>you saved my day&#8230;i was ready to bang my head against the screeen.</p>
<p>#version 8.1.7x</p>
<p>oracle_date := unix_epoch + (unixts/86400);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Life After Coffee &#187; UNIX Time and UNIX Timestamps</title>
		<link>http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/comment-page-1/#comment-381</link>
		<dc:creator>Life After Coffee &#187; UNIX Time and UNIX Timestamps</dc:creator>
		<pubDate>Wed, 19 Apr 2006 01:23:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/#comment-381</guid>
		<description>[...] A recent comment on my story about converting UNIX timestamps to Oracle dates prompted me to do a little extra digging on UNIX time. [...]</description>
		<content:encoded><![CDATA[<p>[...] A recent comment on my story about converting UNIX timestamps to Oracle dates prompted me to do a little extra digging on UNIX time. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon</title>
		<link>http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/comment-page-1/#comment-378</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Tue, 18 Apr 2006 13:47:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/#comment-378</guid>
		<description>Srivalli,

I believe the discrepency you are seing is because the UNIX timestamp is reported in Coordinated Universal Time (UTC).  UTC is equivalent to Greenwich Mean Time (GMT).  To evaluate the date in your local timezone you will need to convert it with the Oracle delivered new_time function as below:

select to_char(new_time(unixts_to_date(1145366808), &#039;GMT&#039;, &#039;EDT&#039;), &#039;MM/DD/YYYY HH24:MI:SS&#039;) from dual

If you grab a UNIX timestamp from a converter on a website be careful, some of them are converting for their own timezone already.  This one allows you to enter an offset from GMT for accurate timestamps:

&lt;a href=&quot;http://www.4webhelp.net/us/timestamp.php&quot; rel=&quot;nofollow&quot;&gt;http://www.4webhelp.net/us/timestamp.php&lt;/a&gt;

Hope this helps.  Perhaps I&#039;ll rewrite this function to compensate for the timezone as well.

Jon</description>
		<content:encoded><![CDATA[<p>Srivalli,</p>
<p>I believe the discrepency you are seing is because the UNIX timestamp is reported in Coordinated Universal Time (UTC).  UTC is equivalent to Greenwich Mean Time (GMT).  To evaluate the date in your local timezone you will need to convert it with the Oracle delivered new_time function as below:</p>
<p>select to_char(new_time(unixts_to_date(1145366808), &#8216;GMT&#8217;, &#8216;EDT&#8217;), &#8216;MM/DD/YYYY HH24:MI:SS&#8217;) from dual</p>
<p>If you grab a UNIX timestamp from a converter on a website be careful, some of them are converting for their own timezone already.  This one allows you to enter an offset from GMT for accurate timestamps:</p>
<p><a href="http://www.4webhelp.net/us/timestamp.php" rel="nofollow">http://www.4webhelp.net/us/timestamp.php</a></p>
<p>Hope this helps.  Perhaps I&#8217;ll rewrite this function to compensate for the timezone as well.</p>
<p>Jon</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: srivalli</title>
		<link>http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/comment-page-1/#comment-375</link>
		<dc:creator>srivalli</dc:creator>
		<pubDate>Tue, 18 Apr 2006 04:33:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/#comment-375</guid>
		<description>I thought it will solve the problem , but its not.
    I implemented the same procedure what ever is given above  for converting from timestamp to  date  and time . It is giveing the correct date but not the time , as my sytem is showing it differently</description>
		<content:encoded><![CDATA[<p>I thought it will solve the problem , but its not.<br />
    I implemented the same procedure what ever is given above  for converting from timestamp to  date  and time . It is giveing the correct date but not the time , as my sytem is showing it differently</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon</title>
		<link>http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/comment-page-1/#comment-299</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Thu, 06 Apr 2006 12:03:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/#comment-299</guid>
		<description>That&#039;s a nice and succinct method Johannes.  The one above does essentially the same thing with a couple variables and a couple more steps, but also provides some exception handling.</description>
		<content:encoded><![CDATA[<p>That&#8217;s a nice and succinct method Johannes.  The one above does essentially the same thing with a couple variables and a couple more steps, but also provides some exception handling.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Johannes Buchner</title>
		<link>http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/comment-page-1/#comment-297</link>
		<dc:creator>Johannes Buchner</dc:creator>
		<pubDate>Thu, 06 Apr 2006 10:35:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/#comment-297</guid>
		<description>This page: 
http://www.internetvibes.net/forum/index.php?showtopic=2872

does the same using 
select TO_DATE(&#039;1970-01-01&#039;, &#039;YYYY-MM-DD&#039;) + numtodsinterval(unixtimestamp, &#039;SECOND&#039;) from dual

Ain&#039;t this much easier and enough though?</description>
		<content:encoded><![CDATA[<p>This page:<br />
<a href="http://www.internetvibes.net/forum/index.php?showtopic=2872" rel="nofollow">http://www.internetvibes.net/forum/index.php?showtopic=2872</a></p>
<p>does the same using<br />
select TO_DATE(&#8217;1970-01-01&#8242;, &#8216;YYYY-MM-DD&#8217;) + numtodsinterval(unixtimestamp, &#8216;SECOND&#8217;) from dual</p>
<p>Ain&#8217;t this much easier and enough though?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon</title>
		<link>http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/comment-page-1/#comment-144</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Fri, 13 Jan 2006 16:22:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/2005/10/20/unix-timestamp-to-oracle-date-conversion/#comment-144</guid>
		<description>It seems the NUMTODSINTERVAL function is new in Oracle 9i.  If you are working with Oracle 8i or earlier you can substitute this line:

oracle_date := unix_epoch + (unixts/86400);

instead of the NUMTODSINTERVAL to eliminate this error.

The NUMTODSINTERVAL function turns the number of seconds into a fractional number representing days.  Dividing the seconds by 86400 (the number of seconds in 1 day) achieves the same thing.</description>
		<content:encoded><![CDATA[<p>It seems the NUMTODSINTERVAL function is new in Oracle 9i.  If you are working with Oracle 8i or earlier you can substitute this line:</p>
<p>oracle_date := unix_epoch + (unixts/86400);</p>
<p>instead of the NUMTODSINTERVAL to eliminate this error.</p>
<p>The NUMTODSINTERVAL function turns the number of seconds into a fractional number representing days.  Dividing the seconds by 86400 (the number of seconds in 1 day) achieves the same thing.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
