DateTimeField is used to store date time values.
class MyModel(models.Model):
start_time = models.DateFimeField(null=True, blank=True)
created_on = models.DateTimeField(auto_now_add=True)
updated_on = models.DateTimeField(auto_now=True)
A DateTimeField
has two optional parameters:
auto_now_add
sets the value of the field to current datetime when the object is created.
auto_now
sets the value of the field to current datetime every time the field is saved.
These options and the default
parameter are mutually exclusive.