Re: convert str to datetime

2012-06-25 Thread Jim Thaxton
The parseutil module is very handy when converting a formatted string into a datetime object. Here's the module: http://labix.org/python-dateutil And here is a stackoverflow post with a number of examples: http://stackoverflow.com/questions/127803/how-to-parse-iso-formatted-date-in-python On Mo

Re: convert str to datetime

2012-06-25 Thread Daniel Roseman
On Monday, 25 June 2012 13:07:19 UTC+1, armagan wrote: > > I don't know where does string come from. In shell date is a date object > and combine time dt is a datetime objects. It's ok. But I run the code I > have an errror. can't compare datetime.datetime to str. > > item = Project.objects.orde

Re: convert str to datetime

2012-06-25 Thread armagan
I don't know where does string come from. In shell date is a date object and combine time dt is a datetime objects. It's ok. But I run the code I have an errror. can't compare datetime.datetime to str. item = Project.objects.order_by('-create_date')[:20] delivery_date = models.DateField(_(u'T

Re: convert str to datetime

2012-06-25 Thread Melvyn Sopacua
On 25-6-2012 10:42, armagan wrote: > Hi, > > I'm trying to convert to str to datetime. "date object" must be datetime > object. Can you help me? > > def item_pubdate(self, item): # Yayinlanma Tarihi > > if item.delivery_date: > > date = item.delivery_date So, that's a stri

Re: convert str to datetime

2012-06-25 Thread Daniel Roseman
On Monday, 25 June 2012 09:42:27 UTC+1, armagan wrote: > > Hi, > > I'm trying to convert to str to datetime. "date object" must be datetime > object. Can you help me? > > def item_pubdate(self, item): # Yayinlanma Tarihi > > if item.delivery_date: > > date = item.delivery_date