how to get current date in vue js?


Question – how to change date format in vue js?, How do I get the current date and time in vuejs? How to get the date in Y-m-d format in vuejs? How do I get time in H:i:s format in vue js?

This Article will useful you to vuex get the current date and time in vuejs tutorial using native JavaScript Date Function. You can also get pure Javascript also applay for date and time in your any type of the formats like Y-m-d and H:i:s formats using v-model in vuejs.

You can learn also my prev Article for vuejs interview questions

Write a Vuejs function to get the current date and time.

vuejs cdn

<script src=""></script>

List of all Google Adsense, VueJS, AngularJS, PHP, Laravel Examples.

Get Current Date & Time in Vue Js

Use Date() methods to make an object in vuejs with current date as well as time. This date and time lname code in vuejs results in UTC timezone.

   var currentDate = new Date();

Chart: get current date in vuejs

get current date in vue js, vue js get current date time, get current date and time in vuejs, get current date in vue, vue display date time, vue get current date time, vue time now
how to get current date in vue js

Current Date in Vuejs

following the We gave you Great simple example with demo therefor you can learn how to show current date and time in vue js basic app.

<!DOCTYPE html>
    <title>How to get current date time in vuejs? -</title>
    <script src=""></script>
<div id="root">
    {{ message }}
<script type="text/javascript">
 new Vue({
    el: '#root',
    data: { 
          message:"Gretting, Welcome To Pakainfo...."
        getdateTime: function () {
            var dateTime = new Date();
            var dateTimeNewFormat = new Date().toJSON().slice(0,10).replace(/-/g,'/');
    mounted () {

We can fetch the current date time example with demo using native JS date Function simply as following-

<!DOCTYPE html>

<p id="dateTime"></p>

document.getElementById("dateTime").innerHTML = Date();


If you can excute the above simple js example it will get the output something like this below-

Thu Jun 04 2020 20:57:22 GMT+0530 (India Standard Time)

Get Current Date in YYYY-MM-DD Format

You can get in Vuejs Best Convert to YYYY-MM-DD Date format easy as below example-

<!DOCTYPE html>

<p id="dateTime"></p>

var pakainfo_dt = new Date();
var month = ('0' + (pakainfo_dt.getMonth() + 1)).slice(-2);
var date = ('0' + pakainfo_dt.getDate()).slice(-2);
var year = pakainfo_dt.getFullYear();
var dateTimeNewFormat = year + '/' + month + '/' + date;
document.getElementById("dateTime").innerHTML = dateTimeNewFormat;


If you excute the above example it will genrate the results below like this-


You can also read vuejs documentation for Date and time

Web Programming Tutorials Example with Demo

Read :


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

I hope you get an idea about Vue.js Date Format.
I would like to have feedback on my 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.   Server side Laravel DataTables example
  2.   vue.js Get Current DateTime Example
  3.   AJAX Pagination with Laravel Example From Scratch
  4.   PHP Multiple images upload using jQuery Ajax
  5.   JavaScript String Methods Functions Example
  6.   Laravel 6 tree view Plugins using jQuery Example
  7.   AJAX Pagination with Laravel 5.7 Example From Scratch
  8.   Laravel 5.7 Toggle switch Update DB field using Ajax
  9.   Getting Current Date Time in Vue.js Date Format
  10.   Create a Fixed Sticky Navigation Menu Bar

Leave a Reply

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