I have data type datetime in MySQL. It show value like this in phpmyadmin.
2023-04-21 09:51:47.539966
I use Django read datetime value from MySQL and convert to Javascript like this code.
<script>
var utc = new Date();
var t = '{{ data_log.updated }}'
var d = new Date(t);
document.write(t)
document.write(d)
</script>
The output can show variable t which is datetime value from MySQL but cannot convert to Date in Javascript.
April 21, 2023, 9:51 a.m.
Invalid Date
The output show that variable d is invalid date. How to convert datetime from MySQL to datetime in Javascript?