I need to assign the current date in a datetime
field of a paragraph, for that I have implemented:
...
var newDate = new Date(),
date = newDate.getFullYear() + "-" + (newDate.getMonth() + 1) + "-" + newDate.getDate() + " " + newDate.getHours() + ":" + newDate.getMinutes() + ":" + newDate.getSeconds();
$(".container").append("<p id=msg" + id + " class='message' datetime=" + date + ">" + userMessage + "</p>");
...
Inserting the inserted information into the browser is formatted incorrectly:
<p id="msg1" class="message" datetime="2015-2-23" 11:26:48="">teste</p>
What do I need to fix so that the result is like this?:
<p id="msg1" class="message" datetime="2015-2-23 11:26:48">teste</p>