<br><br><div class="gmail_quote">On Wed, Apr 2, 2008 at 11:42 AM, Christian Heimes &lt;<a href="mailto:lists@cheimes.de">lists@cheimes.de</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Martin v. Löwis schrieb:<br>
<div class="Ih2E3d">&gt; Can you please explain why this is an important problem?<br>
&gt; Dates before 1900 have all passed long ago, so they shouldn&#39;t<br>
&gt; occur that often in real applications.<br>
</div></blockquote><div><br>In the application where I needed it, the customer wanted to send/store dates for e.g. the date of birth of some people.<br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d"><br>
</div>Does xmlrpc support dates for 1900? For historic dates the Julian Day</blockquote><div><br>The xmlrpc spec says dates should be sent in the following format:<br><br>&nbsp;&lt;dateTime.iso8601&gt;19980717T14:08:55&lt;/dateTime.iso8601&gt;<br>
1900 is a rather arbitrary limit with this format.<br><br>Note that the unpatched xmlrpclib is able to receive datetime objects with dates before 1900:<br>~/ /usr/bin/python2.5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ralf@red ok<br>
Python 2.5.2 (r252:60911, Mar&nbsp; 9 2008, 11:14:55) <br>[GCC 4.2.3 (Debian 4.2.3-2)] on linux2<br>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.<br>&gt;&gt;&gt; import xmlrpclib, datetime<br>
&gt;&gt;&gt; xmlrpclib.loads(&#39;&lt;params&gt;\n&lt;param&gt;\n&lt;value&gt;&lt;dateTime.iso8601&gt;18500101T00:00:00&lt;/dateTime.iso8601&gt;&lt;/value&gt;\n&lt;/param&gt;\n&lt;/params&gt;\n&#39;, use_datetime=True)<br>
((datetime.datetime(1850, 1, 1),), None)<br><br>Dumping however doesn&#39;t work:<br>&gt;&gt;&gt; xmlrpclib.dumps((datetime.datetime(1850, 1, 1),))<br>Traceback (most recent call last):<br>&nbsp; File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br>
&nbsp; File &quot;/usr/lib/python2.5/xmlrpclib.py&quot;, line 1080, in dumps<br>&nbsp;&nbsp;&nbsp; data = m.dumps(params)<br>&nbsp; File &quot;/usr/lib/python2.5/xmlrpclib.py&quot;, line 623, in dumps<br>&nbsp;&nbsp;&nbsp; dump(v, write)<br>&nbsp; File &quot;/usr/lib/python2.5/xmlrpclib.py&quot;, line 635, in __dump<br>
&nbsp;&nbsp;&nbsp; f(self, value, write)<br>&nbsp; File &quot;/usr/lib/python2.5/xmlrpclib.py&quot;, line 725, in dump_datetime<br>&nbsp;&nbsp;&nbsp; write(value.strftime(&quot;%Y%m%dT%H:%M:%S&quot;))<br>&nbsp; File &quot;datetime.py&quot;, line 791, in strftime<br>
&nbsp;&nbsp;&nbsp; return _wrap_strftime(self, fmt, self.timetuple())<br>&nbsp; File &quot;datetime.py&quot;, line 181, in _wrap_strftime<br>&nbsp;&nbsp;&nbsp; &quot;methods require year &gt;= 1900&quot; % year)<br>ValueError: year=1850 is before 1900; the datetime strftime() methods require year &gt;= 1900<br>
<br>This ValueError just shows an implementation detail.<br><br>Note that it&#39;s also possible to send and receive dates before 1900 using xmlrpclib.DateTime objects.<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Number family (MJD or JDN) or Rata Die are more appropriate and much<br>
easier to use. I wish somebody could add both to the datetime module.<br>
<br>&nbsp;</blockquote></div>