Greetings,
When page is loading view, taking date from mysql db model it shows this datetime format:
Oct. 7, 2021, 2:23 a.m.
After AJAX kickin and refresh the table the same model it shows this:
2021-10-06T23:23:45Z
I know whats happening, but still confused.
Can somebody tell me what and where is the right way to make a default datetime format?
For whole django+ajax+java…ALL
settings.py
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_L10N = True
USE_TZ = True
DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S'
part of ajax:
for (var key in response.tblcnt)
{
$("#tblcnt").append(
`
<tr>
<td>${ response.tblcnt[key].dt_first }</td>
</tr>`
)
}
models
dt_first = models.DateTimeField('dt_first',blank=True)
Thank you for any pointers.
I found format_input which is not what i want,for now at least
UPDATE 1:
For regular view this is working:
<td>{{ i.dt_first|date:"Y.m.d H:i:s" }}</td>
output:
2021.10.07 02:23:45
Still need ajax