VueJs Tutorials
- VueJs
- VueJs Instance
- Templates
- Component
- Computed Properties
- Watch Property
- Binding
- Events
- Rendering
- Directives
- Mixins
- Reactive Interface
- String Length
- Onchange Events
- Ternery Operator
- Global variable
- Get data attribute value
- String to array
- How to Get Array Length
- call a function on Page load
- current Date and Time
- Replace String
- Open link on new tab
- setTimeout in Vue JS
- object or array empty or not
- get element by id
- Laravel Vue Flash Message
How to get current Date and Time?
File name : index.php
<!DOCTYPE html>
<html>
<head>
<title>How to get current date time?</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="appid">
{{ msg }}
{{dat}}
</div>
</body>
<script type="text/javascript">
new Vue({
el: '#appid',
data: {
msg:"Welcome Itechxpert, Please Wait........",
dat:""
},
methods:{
callFunction: function () {
var currentDate = new Date();
console.log(currentDate);
this.dat = currentDate;
var currentDateWithFormat = new Date().toJSON().slice(0,10).replace(/-/g,'/');
console.log(currentDateWithFormat);
}
},
mounted () {
this.callFunction()
}
});
</script>
</html>
File name : index.php
File name : index.php
File name : index.php