44
rated 0 times
[
47]
[
3]
/ answers: 1 / hits: 79188
/ 5 Years ago, mon, july 29, 2019, 12:00:00
I need to get current time and date in the webpage , i am having the javascript code for it . not sure how to Implement in vue.js .I am attaching the code sample here.
html and plain js code:
<html>
<body>
<h2>JavaScript new Date()</h2>
<p id=timestamp></p>
<script>
var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
var time = today.getHours() + : + today.getMinutes() + : +
today.getSeconds();
var dateTime = date+' '+time;
document.getElementById(timestamp).innerHTML = dateTime;
</script>
</body>
</html>
i need to implement in vue.js where should i include whether in mounted or computed or method?
More From » vue.js