# Add a method to your model class # call it like any other field in your template class Yourclass(models.Model): date_field = models.DateTimeField() def date_trunc_field(self): return self.date_field.date()
Here is what the above code is Doing:
1. Create a new method in your model class
2. Call it like any other field in your template
3. The method returns the date portion of the datetime field