forum.vmspython.org Forum Index forum.vmspython.org
Forum system
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Date Format error message

 
Post new topic   Reply to topic    forum.vmspython.org Forum Index -> Python for OpenVMS
View previous topic :: View next topic  
Author Message
ojr



Joined: 01 Dec 2010
Posts: 18

PostPosted: Fri Nov 04, 2011 7:27 pm    Post subject: Date Format error message Reply with quote

Hello All,
I attempted to change the date format in python and I received the following message. How can I resolve this?

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: year=1876 is before 1900; the datetime strftime() methods require year >= 1900

Using Python 2.5.4 on OpenVMS 8.4. I appreciate your input. Thank you, ojr
Back to top
View user's profile Send private message
jfp



Joined: 12 Jul 2004
Posts: 636

PostPosted: Sat Nov 05, 2011 9:39 am    Post subject: Reply with quote

Hello,

It is a Python limitation, from the source (2.7.2+) of the datetime module :

Code:
    /* Give up if the year is before 1900.
     * Python strftime() plays games with the year, and different
     * games depending on whether envar PYTHON2K is set.  This makes
     * years before 1900 a nightmare, even if the platform strftime
     * supports them (and not all do).
     * We could get a lot farther here by avoiding Python's strftime
     * wrapper and calling the C strftime() directly, but that isn't
     * an option in the Python implementation of this module.
     */


JF
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ojr



Joined: 01 Dec 2010
Posts: 18

PostPosted: Sun Nov 20, 2011 12:29 am    Post subject: Reply with quote

Ok, thank you for the reply. I can work around it. -ojr
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vmspython.org Forum Index -> Python for OpenVMS All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group