Datetime field with different precisions

Hallo folks,

I would like to have a datetime field in my database that can either be a day, month or year. If it’s for instance just a moth it should be displayed as “July 1994” or if it has the precision of a day it should be displayed as “July, 14th 1994”. What would be an elegant way to do this in a model? Should I use inheritance?

Thanks

Mebus

Part of this decision is going to depend upon how this data goes into the database and what information you may have available to you to determine the “resolution” or “precision” of that date field.

We’ve got a similar issue but with time and not date. What we did was add another field, “precision”, indicating the accuracy of the time field.