<?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: Trouble Getting a Date</title>
	<atom:link href="http://halfcooked.com/blog/2008/05/09/trouble-getting-a-date/feed/" rel="self" type="application/rss+xml" />
	<link>http://halfcooked.com/blog/2008/05/09/trouble-getting-a-date/</link>
	<description>Wherein I write some stuff  that you may like to read. Or not, its up to you really.</description>
	<lastBuildDate>Mon, 01 Feb 2010 16:43:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: David Welden</title>
		<link>http://halfcooked.com/blog/2008/05/09/trouble-getting-a-date/comment-page-1/#comment-32822</link>
		<dc:creator>David Welden</dc:creator>
		<pubDate>Sat, 10 May 2008 20:22:59 +0000</pubDate>
		<guid isPermaLink="false">http://halfcooked.com/blog/?p=63#comment-32822</guid>
		<description>Glad to know I am not the only one who always trips over this, but I always figured it is because dates are so rarely used in real world programming ;-) One of the few ugly warts in Python I don&#039;t like to discuss with the unbelievers. Absolutely this mess needs to be cleaned up, preferably in a new class that consolidates the intended functionality of all of the different standard modules. &quot;Preferably one way to do things&quot;, no?</description>
		<content:encoded><![CDATA[<p>Glad to know I am not the only one who always trips over this, but I always figured it is because dates are so rarely used in real world programming <img src='http://halfcooked.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  One of the few ugly warts in Python I don&#8217;t like to discuss with the unbelievers. Absolutely this mess needs to be cleaned up, preferably in a new class that consolidates the intended functionality of all of the different standard modules. &#8220;Preferably one way to do things&#8221;, no?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: T Middleton</title>
		<link>http://halfcooked.com/blog/2008/05/09/trouble-getting-a-date/comment-page-1/#comment-32787</link>
		<dc:creator>T Middleton</dc:creator>
		<pubDate>Fri, 09 May 2008 18:28:21 +0000</pubDate>
		<guid isPermaLink="false">http://halfcooked.com/blog/?p=63#comment-32787</guid>
		<description>PostgreSQL has nice &quot;timestamp&quot;, &quot;interval&quot;, &quot;date&quot; and &quot;time&quot; datatypes, and decent functions for date math/manipulation (up to microsecond resolution). I usually do most of my date math/formating inside my postgresql queries for this reason and just have it spit out text for python. Kind of sad in a way, but better than some of your frustration above for my uses.</description>
		<content:encoded><![CDATA[<p>PostgreSQL has nice &#8220;timestamp&#8221;, &#8220;interval&#8221;, &#8220;date&#8221; and &#8220;time&#8221; datatypes, and decent functions for date math/manipulation (up to microsecond resolution). I usually do most of my date math/formating inside my postgresql queries for this reason and just have it spit out text for python. Kind of sad in a way, but better than some of your frustration above for my uses.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ira</title>
		<link>http://halfcooked.com/blog/2008/05/09/trouble-getting-a-date/comment-page-1/#comment-32783</link>
		<dc:creator>Ira</dc:creator>
		<pubDate>Fri, 09 May 2008 16:37:30 +0000</pubDate>
		<guid isPermaLink="false">http://halfcooked.com/blog/?p=63#comment-32783</guid>
		<description>Just to make things a little more confusing, SQL Server has a timestamp data type... but it doesn&#039;t even remotely conform to ANSI/ISO standards.  Instead, it&#039;s a synonym for rowversion.

And to confirm, SQL Server only provides datetime (and smalldatetime, half the size but less precision).</description>
		<content:encoded><![CDATA[<p>Just to make things a little more confusing, SQL Server has a timestamp data type&#8230; but it doesn&#8217;t even remotely conform to ANSI/ISO standards.  Instead, it&#8217;s a synonym for rowversion.</p>
<p>And to confirm, SQL Server only provides datetime (and smalldatetime, half the size but less precision).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mariano</title>
		<link>http://halfcooked.com/blog/2008/05/09/trouble-getting-a-date/comment-page-1/#comment-32780</link>
		<dc:creator>Mariano</dc:creator>
		<pubDate>Fri, 09 May 2008 14:50:39 +0000</pubDate>
		<guid isPermaLink="false">http://halfcooked.com/blog/?p=63#comment-32780</guid>
		<description>Andy, you need to use &quot;date&quot; or &quot;timestamp&quot; (I think it matters if you write it lowercase or uppercase) as the sqlite&#039;s datatype to make it work (this comes by default in sqlite3 but you can write an adapter/converter to build whatever datatype you want to store).

See sqlite3&#039;s doc for more on this: http://docs.python.org/lib/node348.html</description>
		<content:encoded><![CDATA[<p>Andy, you need to use &#8220;date&#8221; or &#8220;timestamp&#8221; (I think it matters if you write it lowercase or uppercase) as the sqlite&#8217;s datatype to make it work (this comes by default in sqlite3 but you can write an adapter/converter to build whatever datatype you want to store).</p>
<p>See sqlite3&#8217;s doc for more on this: <a href="http://docs.python.org/lib/node348.html" rel="nofollow">http://docs.python.org/lib/node348.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurence Rowe</title>
		<link>http://halfcooked.com/blog/2008/05/09/trouble-getting-a-date/comment-page-1/#comment-32776</link>
		<dc:creator>Laurence Rowe</dc:creator>
		<pubDate>Fri, 09 May 2008 14:08:23 +0000</pubDate>
		<guid isPermaLink="false">http://halfcooked.com/blog/?p=63#comment-32776</guid>
		<description>Leave stftime, strptime as they are, any coming from C (or indeed php) expects them to work that way.

The datetime library is great, none of the dbapi drivers I know use mx.DateTime anymore. Add pytz to get timezone support.

If you are working with relational databases, then give SQLAlchemy a try.</description>
		<content:encoded><![CDATA[<p>Leave stftime, strptime as they are, any coming from C (or indeed php) expects them to work that way.</p>
<p>The datetime library is great, none of the dbapi drivers I know use mx.DateTime anymore. Add pytz to get timezone support.</p>
<p>If you are working with relational databases, then give SQLAlchemy a try.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marius Gedminas</title>
		<link>http://halfcooked.com/blog/2008/05/09/trouble-getting-a-date/comment-page-1/#comment-32768</link>
		<dc:creator>Marius Gedminas</dc:creator>
		<pubDate>Fri, 09 May 2008 10:11:23 +0000</pubDate>
		<guid isPermaLink="false">http://halfcooked.com/blog/?p=63#comment-32768</guid>
		<description>Your blog is not escaping less-than and greater-than characters, so browsers interpret them as strange malformed HTML elements named &quot;type&quot;.</description>
		<content:encoded><![CDATA[<p>Your blog is not escaping less-than and greater-than characters, so browsers interpret them as strange malformed HTML elements named &#8220;type&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dominic Brooks</title>
		<link>http://halfcooked.com/blog/2008/05/09/trouble-getting-a-date/comment-page-1/#comment-32765</link>
		<dc:creator>Dominic Brooks</dc:creator>
		<pubDate>Fri, 09 May 2008 08:14:29 +0000</pubDate>
		<guid isPermaLink="false">http://halfcooked.com/blog/?p=63#comment-32765</guid>
		<description>In addition to DATE, Oracle has had TIMESTAMP and INTERVAL since 9i. 
Doesn&#039;t make things any easier for you though.</description>
		<content:encoded><![CDATA[<p>In addition to DATE, Oracle has had TIMESTAMP and INTERVAL since 9i.<br />
Doesn&#8217;t make things any easier for you though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Todd</title>
		<link>http://halfcooked.com/blog/2008/05/09/trouble-getting-a-date/comment-page-1/#comment-32762</link>
		<dc:creator>Andy Todd</dc:creator>
		<pubDate>Fri, 09 May 2008 05:53:53 +0000</pubDate>
		<guid isPermaLink="false">http://halfcooked.com/blog/?p=63#comment-32762</guid>
		<description>Mariano, I didn&#039;t know about PARSE_DECLTYPES so I added it to my sample code above, and got a nice error message when I tried to retrieve my data;

&lt;pre&gt;
n [17]: curs.execute(&quot;SELECT * FROM date_test&quot;)
---------------------------------------------------------------------------
&lt;type &#039;exceptions.TypeError&#039;&gt;             Traceback (most recent call last)

~/Work/Python/&lt;ipython console&gt; in &lt;module&gt;()

/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/sqlite3/dbapi2.py in convert_date(val)
     61
     62     def convert_date(val):
---&gt; 63         return datetime.date(*map(int, val.split(&quot;-&quot;)))
     64
     65     def convert_timestamp(val):
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Mariano, I didn&#8217;t know about PARSE_DECLTYPES so I added it to my sample code above, and got a nice error message when I tried to retrieve my data;</p>
<pre>
n [17]: curs.execute("SELECT * FROM date_test")
---------------------------------------------------------------------------
<type 'exceptions.TypeError'>             Traceback (most recent call last)

~/Work/Python/<ipython console> in <module>()

/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/sqlite3/dbapi2.py in convert_date(val)
     61
     62     def convert_date(val):
---> 63         return datetime.date(*map(int, val.split("-")))
     64
     65     def convert_timestamp(val):
</module></ipython></type></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mariano</title>
		<link>http://halfcooked.com/blog/2008/05/09/trouble-getting-a-date/comment-page-1/#comment-32757</link>
		<dc:creator>Mariano</dc:creator>
		<pubDate>Fri, 09 May 2008 03:41:15 +0000</pubDate>
		<guid isPermaLink="false">http://halfcooked.com/blog/?p=63#comment-32757</guid>
		<description>Umm it seems it doesn&#039;t get print, anyway give it a try :)</description>
		<content:encoded><![CDATA[<p>Umm it seems it doesn&#8217;t get print, anyway give it a try <img src='http://halfcooked.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mariano</title>
		<link>http://halfcooked.com/blog/2008/05/09/trouble-getting-a-date/comment-page-1/#comment-32756</link>
		<dc:creator>Mariano</dc:creator>
		<pubDate>Fri, 09 May 2008 03:39:56 +0000</pubDate>
		<guid isPermaLink="false">http://halfcooked.com/blog/?p=63#comment-32756</guid>
		<description>Sorry, I missed the output from print type(r[0]):

type(r[0])
</description>
		<content:encoded><![CDATA[<p>Sorry, I missed the output from print type(r[0]):</p>
<p>type(r[0])</p>
]]></content:encoded>
	</item>
</channel>
</rss>
