Home » Getting Current Date Time in Vue.js Date Format

Getting Current Date Time in Vue.js Date Format

Today, We want to share with you Getting Current Date Time in Vue.js Date Format.In this post we will show you vue format date without moment, hear for Vue.Js Get Current Date time we will give you demo and example for implement.In this post, we will learn about vue-moment(date format) with an example.

Getting Current Date Time in Vue.js Date Format

There are the Following The simple About vuejs-datepicker v-model Full Information With Example and source code.

Read Also:  AngularJS Get Current Date Time Example

As I will cover this Post with live Working example to develop vue display current time, so the vue formatted date is used for this example is following below.

Vue Js Get Current Date and Time Example

HTML Part

<div>
  <input type="text" class="form-control" v-model="date">
</div>

<button type="button" @click="getDataFromServer()">
  Get Data
</button>

<button type="button" @click="saveDataToServer()">
  Send Data
</button>

JavaScript Part

new Vue({
        el: 'body',
        data: {
          date: null,
        },
        methods: {
        	getDataFromServer: function() {

        		  	var serverDate = '2022-06-26';
        		  	this.date = this.frontEndDateFormat(serverDate);
        	},
        	saveDataToServer: function() {
        		var serverDate = this.backEndDateFormat(this.date);
            alert(serverDate);
        	},
        	frontEndDateFormat: function(date) {
        		return moment(date, 'YYYY-MM-DD').format('DD/MM/YYYY');
        	},
        	backEndDateFormat: function(date) {
        		return moment(date, 'DD/MM/YYYY').format('YYYY-MM-DD');
        	}
        }
 });      

CSS Part

div {
  margin-bottom: 20px;
}
input {
  padding: 5px 10px; font-size:16px;
}
button {
  padding: 10px 20px; border-radius:0;
}

Web Programming Tutorials Example with Demo

Read :

Read Also:  Simple VueJS Array Mutate Example with Demo

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Vue Js Get Current Date and Time Example.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.


Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  Managing Dates and Times Using Vue.js?
  2. Read Also:  Star Rating System using jQuery
  3. Read Also:  Laravel 6 String Explode and Implode Tutorial
  4. Read Also:  vue Select Box binding Example
  5. Read Also:  Laravel vuejs Insert Multiple Checkbox Value in Database
  6. Read Also:  how to get current date in vue js?
  7. Read Also:  Simple jQuery Form Validator validation
  8. Read Also:  Concatenation string and Class in VueJS
  9. Read Also:  vue.js Get Current DateTime Example
  10. Read Also:  laravel Views share Variable multiple to controller

Leave a Comment

Your email address will not be published. Required fields are marked *