Datetime Column - Show in User's timezone - How?

Datetime Column - Show in User's timezone - How?

johnthomas00johnthomas00 Posts: 8Questions: 3Answers: 1

Using Django to server Json data via ajax calls.
Datetime fields are coming in as UTC, as they are saved in the database.
Datatables is showning the data as UTC, eg. 2017-05-07 12:23:15 AM UTC
When I return datetime field with timezone data, I get an error:
"DataTables warning: table id=test - ValueError Not naive datetime (tzinfo is already set)

How do I get the datetime column to show in the user's timezone, please?

Replies

  • allanallan Posts: 63,889Questions: 1Answers: 10,530 Site admin

    The error message is coming from the server-side. DataTables is displaying it because you are setting the error property in the JSON response from the server with the text "ValueError Not naive datetime (tzinfo is already set)". Hence why DataTables is displaying it.

    You'd need to refer to the Django documentation to resolve that issue.

    Allan

This discussion has been closed.