I need to be able to write only the year, year or month (in addition to the standard full date and time values) in some of my datetime fields. Like these pictures below.
YYYY
YYYY-MM
YYYY-MM-DD
YYYY-MM-DD HH
YYYY-MM-DD HH:MM
YYYY-MM-DD HH:MM:SS
In mySQL, this can easily be done using zeros, but this does not work in django. This is a dumb python time.datetime function that does not support it.
Is there an easy way to do this in django? If not, are there any extensions that can do this for me? If not, how can I solve this in the best way?
It would be good for me if he could cope with the normalization of local time material, if that was the full value of the data time. That way, I could use the same field everywhere. But this is not very important.
source
share