<?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: Oracle, SQL, Dates and Timestamps</title>
	<atom:link href="http://www.lifeaftercoffee.com/2005/09/14/oracle-sql-dates-and-timestamps/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lifeaftercoffee.com/2005/09/14/oracle-sql-dates-and-timestamps/</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: Tanu</title>
		<link>http://www.lifeaftercoffee.com/2005/09/14/oracle-sql-dates-and-timestamps/comment-page-1/#comment-372031</link>
		<dc:creator>Tanu</dc:creator>
		<pubDate>Fri, 06 Feb 2009 19:06:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/?p=67#comment-372031</guid>
		<description>I have column REQDATE of type DATE in Oracle. when i insert record it gets stored as &quot;09/14/2005 09:08:32 PM&quot; format.

In my Java code I get another date of same type as:
String resDate = rs.getString(&quot;RESDATE&quot;);
//then i format resDate as &quot;MM/dd/yyyy hh:mi:ss&quot; but i dont get the AM/PM part so following qry fails and returns no records.

In my Java code I have to compare the date using qry:
&quot;select * from REQ_ENTRY where REQDATE = to_date(&#039;&quot;+ resDate + &quot;&#039;,&#039;MM/DD/RR HH12:MI:SS PM&#039;)&quot;

Please reply .....</description>
		<content:encoded><![CDATA[<p>I have column REQDATE of type DATE in Oracle. when i insert record it gets stored as &#8220;09/14/2005 09:08:32 PM&#8221; format.</p>
<p>In my Java code I get another date of same type as:<br />
String resDate = rs.getString(&#8221;RESDATE&#8221;);<br />
//then i format resDate as &#8220;MM/dd/yyyy hh:mi:ss&#8221; but i dont get the AM/PM part so following qry fails and returns no records.</p>
<p>In my Java code I have to compare the date using qry:<br />
&#8220;select * from REQ_ENTRY where REQDATE = to_date(&#8217;&#8221;+ resDate + &#8220;&#8216;,&#8217;MM/DD/RR HH12:MI:SS PM&#8217;)&#8221;</p>
<p>Please reply &#8230;..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adele</title>
		<link>http://www.lifeaftercoffee.com/2005/09/14/oracle-sql-dates-and-timestamps/comment-page-1/#comment-370879</link>
		<dc:creator>Adele</dc:creator>
		<pubDate>Thu, 13 Nov 2008 23:42:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/?p=67#comment-370879</guid>
		<description>Hi Jon, thanks for your article
I&#039;m just trying to write some code in SQL in order to find out what day of the week was a specified date, for instance, 01-01-2000. It supposed to be something very simple but I&#039;m struggling with it the whole evening, may be you&#039;ve got any idea? THanks in advance</description>
		<content:encoded><![CDATA[<p>Hi Jon, thanks for your article<br />
I&#8217;m just trying to write some code in SQL in order to find out what day of the week was a specified date, for instance, 01-01-2000. It supposed to be something very simple but I&#8217;m struggling with it the whole evening, may be you&#8217;ve got any idea? THanks in advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Emmons</title>
		<link>http://www.lifeaftercoffee.com/2005/09/14/oracle-sql-dates-and-timestamps/comment-page-1/#comment-311271</link>
		<dc:creator>Jon Emmons</dc:creator>
		<pubDate>Wed, 24 Oct 2007 13:36:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/?p=67#comment-311271</guid>
		<description>Lanka,

You should be able to make this work but you will want to group by a slightly different criteria than you sort by.  It should be something like this:

select to_char(activity_date, &#039;MON&#039;) month
from accounts
group by month
order by to_char(activity_date, &#039;MM&#039;);

That should give you the three letter date in the output.  By using an alias for the column we can reuse the column in the group by statement but in the order by statement we perform a separate to_char to get the month as a number so it will sort properly.

Hope this helps.</description>
		<content:encoded><![CDATA[<p>Lanka,</p>
<p>You should be able to make this work but you will want to group by a slightly different criteria than you sort by.  It should be something like this:</p>
<p>select to_char(activity_date, &#8216;MON&#8217;) month<br />
from accounts<br />
group by month<br />
order by to_char(activity_date, &#8216;MM&#8217;);</p>
<p>That should give you the three letter date in the output.  By using an alias for the column we can reuse the column in the group by statement but in the order by statement we perform a separate to_char to get the month as a number so it will sort properly.</p>
<p>Hope this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lanka</title>
		<link>http://www.lifeaftercoffee.com/2005/09/14/oracle-sql-dates-and-timestamps/comment-page-1/#comment-305533</link>
		<dc:creator>lanka</dc:creator>
		<pubDate>Mon, 15 Oct 2007 12:27:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/?p=67#comment-305533</guid>
		<description>hey i want to group some data by month and sort it also by month(mon format).i have problems in formatting.itz taking alphabettical order
please help with sample code</description>
		<content:encoded><![CDATA[<p>hey i want to group some data by month and sort it also by month(mon format).i have problems in formatting.itz taking alphabettical order<br />
please help with sample code</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Emmons</title>
		<link>http://www.lifeaftercoffee.com/2005/09/14/oracle-sql-dates-and-timestamps/comment-page-1/#comment-13107</link>
		<dc:creator>Jon Emmons</dc:creator>
		<pubDate>Tue, 28 Nov 2006 02:14:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/?p=67#comment-13107</guid>
		<description>Setya,

Most developers will accomplish this by using numbers to represent hour, minute and second.  You could instead use the DATE datatype and ignore the day, month and year on your selects, but sorting will become difficult, especially since if you do not specify day, month and year on the insert Oracle will default to the first day of the current month.

Hope this helps.</description>
		<content:encoded><![CDATA[<p>Setya,</p>
<p>Most developers will accomplish this by using numbers to represent hour, minute and second.  You could instead use the DATE datatype and ignore the day, month and year on your selects, but sorting will become difficult, especially since if you do not specify day, month and year on the insert Oracle will default to the first day of the current month.</p>
<p>Hope this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Setya</title>
		<link>http://www.lifeaftercoffee.com/2005/09/14/oracle-sql-dates-and-timestamps/comment-page-1/#comment-11968</link>
		<dc:creator>Setya</dc:creator>
		<pubDate>Thu, 23 Nov 2006 06:06:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/?p=67#comment-11968</guid>
		<description>Great article,

Can I insert data of date type which consists of time only (without date) and later querying the data by specifying time only ? In essence, I only care about time not date.

Thx in advance,

Setya</description>
		<content:encoded><![CDATA[<p>Great article,</p>
<p>Can I insert data of date type which consists of time only (without date) and later querying the data by specifying time only ? In essence, I only care about time not date.</p>
<p>Thx in advance,</p>
<p>Setya</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Liam</title>
		<link>http://www.lifeaftercoffee.com/2005/09/14/oracle-sql-dates-and-timestamps/comment-page-1/#comment-5356</link>
		<dc:creator>Liam</dc:creator>
		<pubDate>Thu, 21 Sep 2006 09:29:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/?p=67#comment-5356</guid>
		<description>Great page! I would just like to point out that in the code shown on this page there are several different types of single quote used. This often happens when text editors (such as Word) think the text is in English and try to correct the punctuation, changing your SQL-compliant quotes to pairs of 69-style quotes. If you copy this code, be sure to change them back. Hope this helps out some of the 81 people daily who read this page :)</description>
		<content:encoded><![CDATA[<p>Great page! I would just like to point out that in the code shown on this page there are several different types of single quote used. This often happens when text editors (such as Word) think the text is in English and try to correct the punctuation, changing your SQL-compliant quotes to pairs of 69-style quotes. If you copy this code, be sure to change them back. Hope this helps out some of the 81 people daily who read this page <img src='http://www.lifeaftercoffee.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zach</title>
		<link>http://www.lifeaftercoffee.com/2005/09/14/oracle-sql-dates-and-timestamps/comment-page-1/#comment-4990</link>
		<dc:creator>Zach</dc:creator>
		<pubDate>Fri, 08 Sep 2006 18:48:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/?p=67#comment-4990</guid>
		<description>Just a reminder that this page flippin&#039; rocks.  Count right now as another occasion that I did not walk down the hall and bug you, but instead reread the appropriate section and answered my own question.</description>
		<content:encoded><![CDATA[<p>Just a reminder that this page flippin&#8217; rocks.  Count right now as another occasion that I did not walk down the hall and bug you, but instead reread the appropriate section and answered my own question.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon</title>
		<link>http://www.lifeaftercoffee.com/2005/09/14/oracle-sql-dates-and-timestamps/comment-page-1/#comment-4847</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Tue, 05 Sep 2006 16:00:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/?p=67#comment-4847</guid>
		<description>MM versus MI must be the single most common mistake with the date functions.  Glad this helped.</description>
		<content:encoded><![CDATA[<p>MM versus MI must be the single most common mistake with the date functions.  Glad this helped.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Afzal</title>
		<link>http://www.lifeaftercoffee.com/2005/09/14/oracle-sql-dates-and-timestamps/comment-page-1/#comment-4845</link>
		<dc:creator>Afzal</dc:creator>
		<pubDate>Tue, 05 Sep 2006 15:56:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.lifeaftercoffee.com/?p=67#comment-4845</guid>
		<description>Thank you.  It is a Quick and Good reference. I was stuck comparing dates. By your reference, I caught my mistake in the format &#039;HH:MM:SS&#039; field which s/b &#039;HH:MI:SS AM&#039;. 
Thanks again.
Afzal</description>
		<content:encoded><![CDATA[<p>Thank you.  It is a Quick and Good reference. I was stuck comparing dates. By your reference, I caught my mistake in the format &#8216;HH:MM:SS&#8217; field which s/b &#8216;HH:MI:SS AM&#8217;.<br />
Thanks again.<br />
Afzal</p>
]]></content:encoded>
	</item>
</channel>
</rss>
