django-models-5

Last Updated :
Discuss
Comments

Which Django field stores both date and time for event logging, supports auto-setting the value only when the record is created, and internally uses Python’s datetime.datetime type?

DateField(auto_now_add=True) – Stores only the date using datetime.date

TimeField(auto_now_add=True) – Stores only the time using datetime.time

DurationField(auto_now_add=True) – Stores time intervals using datetime.timedelta

DateTimeField(auto_now_add=True) – Stores full date and time using datetime.datetime

Tags:
Share your thoughts in the comments