Difference Between Dateproperty And Datetimeproperty
Solution 1:
I would say that DateProperty
is when you want a date-part only (i.e. dd/mm/yyyy
or whatever format), and DateTimeProperty
is useful when you want a full date & time representation (i.e. dd/mm/yyyy 00:00:00
or whatever format).
Solution 2:
From the docs:
These take values belonging to the corresponding classes (date, time, datetime) of the standard Python datetime module. The most general of the three is DateTimeProperty, which denotes both a calendar date and a time of day; the others are occasionally useful for special purposes requiring just a date (such as a date of birth) or just a time (such as a meeting time). For technical reasons, DateProperty and TimeProperty are subclasses of DateTimeProperty, but you shouldn't depend on this inheritance relationship (and note that it differs from the inheritance relationships between the underlying classes defined by the datetime module itself).
As expected, one is used if you don't need any reference to the time (eg: just the date), the other when you want the full information. When you would use one or the other completely depends on what information you need at a very precise moment.
Post a Comment for "Difference Between Dateproperty And Datetimeproperty"