On 4/05/2015 12:31 PM, Tom Lockhart wrote:
Surely that would destroy data which wouldn’t be desirable.
I’m not sure how that follows.

If you are adjusting a date from whatever it actually is to the first of the month you lose the actual date.

Although the question does not state
it explicitly, I believe that the OP is interested in dates for which
only the year and month are significant.

Granted. If that is correct.

Saving the month as a
separate field seems to overly complicate the problem if any
date/time arithmetic is required.

Saving a date adjusted to the first of the month also involves a complication - or at least some work - then you extract the month to be displayed or queried.

Extracting the month from a date is the same no matter whether it is the first or the ninth.

Who knows when the requirements will change but you can guarantee they will change and Murphy's law says it will happen after you have thrown data away.

Anyway, your choices are to calculate it every time you need it or do it once and use it thereafter. The right choice will depend on the requirements. Which will change.

Cheers

Mike

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5546EBE6.1010705%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

Reply via email to