strptime - dates formatted differently on different computers
jenn.duerr at gmail.com
Mon Dec 10 22:18:06 CET 2012
Follow-on question to this earlier topic - https://groups.google.com/d/topic/comp.lang.python/wnUlPBBNah8/discussion
Was curious to know if there was a way to handle different user computers with different operating system set date formats. 2/10/2006 vs 2-10-2006, for example. Not an issue for my current task, but was just curious how this could be handled?
If in my code I am declaring the user entered date foramtted as
x = datetime.datetime.strptime(user_entered_time , "%m/%d/%Y %I:%M:%S %p") # format for my computer
but on another person's computer, their's is set as 2-10-2006 14:26:06, the code fails. Can this be accounted for?
More information about the Python-list