Re: convert str to datetime
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'Teslim Tarihi'), blank=True, null=True)
On Monday, June 25, 2012 2:27:13 PM UTC+3, Melvyn Sopacua wrote:
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 string and you need it to be a date object. Where does the
string come from and what does it look like?
--
Melvyn Sopacua
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/McDocE6hwF0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home