I have read a lot of thread about the subject, but i'm not much into programming... i've made some tests but never acheive what i wanted.
Here we have a html template we have to modify to suit our needs.
here the code i have to edit:
<p id="DATE"></p>
<script>
var d = new Date();
document.getElementById("DATE").innerHTML = d.toString();
</script>
Its giving me the date OK...but not i the format i want... the format i want is... DD-MM-YYYY HH:MM
Simple has that :)
Its been a couple of hours and i can't do it... Can anyone help with a code i just can copy/paste in my html file.
As opposed to using an external JavaScript library for a simple task. You should be able to achieve the same with Vanilla js.
Refer to this: Where can I find documentation on formatting a date in JavaScript?
In short:
The above snippet should have all the code you need.
For your specific implementation, you will need to do the below:
A function for the format you require is fairly simple. The following will return a string for a provided Date, or the current date if none passed.
BTW, you can't use the same token for two separate parts. While there is no standard or even consistency for formatting tokens, your format would be more commonly expressed as:
Which is compatible with moment.js and a few others, though there are many other token sets to represent the same format.