Vue Current Date
.jpg)
In this tutorial, we will learn how to get the current date using Vue 3 and the new Date()
object to dynamically retrieve the current date.

written

reviewed

updated

Thanks for your feedback!
Your contributions will help us to improve service.
How to Get Current Date in Vue 3?
In the example below, we provide code to get the current date in Vue 3. Check it out now and use it in your project. You can also try editing or customizing it to suit your preferences.
Vue 3 Get Current Date
Copied to Clipboard
19
<script type="module">
const {createApp, ref,onMounted} = Vue;
createApp({
setup() {
const currentDate = ref('');
onMounted(() => {
getCurrentDate();
});
function getCurrentDate() {
const date = new Date();
currentDate.value = date.toDateString();
}
return {
currentDate
};
}
}).mount("#app");
</script>
Output of Vue Format Date
Ad