Vue gets sample code for the current system date (year, month, and date)
1. First copy the following method into the front-end code
/** * Check the date of the day */ getNowDate() { const timeOne = new Date() const year = () let month = () + 1 let day = () month = month < 10 ? '0' + month : month day = day < 10 ? '0' + day : day const NOW_MONTHS_AGO = `${year}-${month}-${day}` return NOW_MONTHS_AGO }
2. Then call it with other methods (the following is the example)
init() { = () + ' ' + '00:00:00', //Result: Current date 0 o'clock = () + ' ' + '23:59:59' //Result: The last second of the current date }
The above is the detailed content of the sample code for Vue to obtain the current system date (year, month and day). For more information about Vue to obtain the current system date, please follow my other related articles!
Related Articles
webpack+vuex+axios sample code for cross-domain request data
This article mainly introduces webpack+vuex+axios cross-domain request data. The editor thinks it is quite good. I will share it with you now and give you a reference. Let's take a look with the editor2018-03-03vue realizes digital scrolling effect
This article mainly introduces the digital scrolling effect of vue in detail. The sample code in the article is introduced in detail and has certain reference value. Interested friends can refer to it.2020-06-06Detailed explanation of the example of using Swiper to implement carousel diagrams in Vue3
This article mainly introduces a detailed explanation of the example of using Swiper to implement carousel images for Vue3. Friends in need can refer to it for reference. I hope it can be helpful. I wish you more progress and an early promotion and salary increase2023-02-02After vue is packaged, errors of 304 and 404 are reported using the backend interface.
This article mainly introduces the problems of error 304 and 404 using the backend interface after vue is packaged. It has good reference value and hopes it will be helpful to everyone. If there are any mistakes or no complete considerations, I hope you will be very grateful for your advice2023-05-05Vue + AnimeJS Detailed Code for Implementing 3d Carousel Diagrams
Carousel diagrams are often used in development, and 3D carousel diagrams are the most commonly used ones, so in this article, I will introduce to you Vue + AnimeJS to implement 3d carousel diagrams. There are detailed code examples for your reference, which have certain reference value. Friends who need it can refer to it.2024-01-01In-depth analysis of the use of this.$forceUpdate() in Vue
This.$forceUpdate() is an important example method. This article mainly introduces the in-depth analysis of the use of this.$forceUpdate() in Vue. It has certain reference value. Those who are interested can learn about it.2024-07-07The difference between hash mode and history mode in Vue-router
This article mainly introduces the difference between the hash mode and history mode in Vue-router. The editor thinks it is quite good. I will share it with you now and give you a reference. Let's take a look with the editor2018-07-07vue+elementUI implements table keyword filtering to highlight
This article mainly introduces the implementation of table keyword filtering highlighting for vue+elementUI. The sample code in the article is introduced in detail and has a certain reference value. Interested friends can refer to it.2019-05-05vue el-table implements custom table header
This article mainly introduces the custom table header implementation of vue el-table. The sample code in the article is introduced in detail and has certain reference value. Interested friends can refer to it.2019-12-12Use van-picker to dynamically set the current selected item
This article mainly introduces the dynamic setting of the current selection using van-picker, which is of good reference value and hopes it will be helpful to everyone. If there are any mistakes or no complete considerations, I hope you will be very grateful for your advice2022-10-10