Hi all, I have come across an error when I tried to format a datetime in a webpage. This the part of webpage:
{% for record in records.object_list %} <tr> <td height="20" bgcolor="#FFFFFF">{{record.ComplaintPhone}}</td> <td bgcolor="#FFFFFF">{{record.CustomerName}}</td> <td bgcolor="#FFFFFF" >{{record.ComplaintTime|time:"Y-m-d H:i"}}</td> <td bgcolor="#FFFFFF" >{{record.ComplaintService}}</td> <td bgcolor="#FFFFFF" >{{record.ComplaintDetail}}</td> <td bgcolor="#FFFFFF" >{{record.CustomerArea}}</td> <td bgcolor="#FFFFFF" >{{record.IsSolved}}</td> <td bgcolor="#FFFFFF" >{{record.SolveTime|time:"Y-m-d H:i"}}</td> <td bgcolor="#FFFFFF" >{{record.SolveMethod}}</td> <td bgcolor="#FFFFFF" >{{record.Username}}</td> <td bgcolor="#FFFFFF" >{{record.Remark}}</td> <td height="20" bgcolor="#FFFFFF" >{{record.Intime|time:"Y-m-d H:i"}}</td> </tr> {% endfor %} The "records" here is a QuerySet came from view: records = Report.objects.order_by('-Intime').all() I tested in shell: >>>record = Report.objects.get(pk=1) >>>record.ComplaintTime.strftime('%Y-%m-%d %H:%M') '2011-01-28 15:29' It showed correctly. Also the attribution of "SolveTime" and "Intime". But when I used "record.ComplaintTime.strftime('%Y-%m-%d %H:%M')" in webpage, it said "Could not parse". So I changed to use "time" filter as above. But now it shows nothing in those three time fields. I do not know why. Would someone pleased to tell where I am wrong? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.