current position:Home>Ask questions about the use of switch in JS.
Ask questions about the use of switch in JS.
2022-02-04 16:56:06 【CSDN Q & A】
I'd like to ask how to judge whether this year is a leap year by obtaining the system year .
Take the answer :
The main code of the problem is as follows , Help, please Adopt 【 This answer is in the upper right corner 】, thank you ~~ If you have other questions, you can continue to communicate ~
var y = new Date().getFullYear(); if (y % 400 == 0 || (y % 4 == 0 && y % 100 != 1))document.write(y+' Year is ruinian ') else document.write(y+' Year is a normal year ')
Other answers 2:
var y = new Date().getFullYear();if (y % 4 == 0 && y % 100 != 0 || y % 400 == 0) alert(y+' Year is a leap year ');else alert(y+' Year is a normal year ');
perhaps
var y = new Date().getFullYear();if (new Date(y,2,0).getDate()==29) alert(y+' Year is a leap year ');else alert(y+' Year is a normal year ');
If help , Hope to adopt ! thank you ! Click my answer Top right 【 Adopt 】 Button
Other answers 3:
You use... To judge leap years if Just judge .
Other answers 4:
This is similar to the problem of business knowledge , No java The problem of , Refer to Baidu Encyclopedia below
Where there are leap days in the solar calendar (2 month 29 Japan ) A year of , Leap surplus ( When you are over the age of ten . The time difference between the lunar calendar and the year of return ).
1582 The intercalation rule since :
Common leap year : The Gregorian calendar year is 4 Multiple , It's not 100 Multiple of , For leap year ( Such as 2004 year 、2020 Years are leap years ).
Leap year of the century : The Gregorian calendar year is a hundred , Must be 400 A leap year is a multiple of ( Such as 1900 Year is not a leap year ,2000 Year is a leap year ).
1582 Practice before : A leap in four years ; If A.D A Year of A( Positive numbers ) Can be 4 to be divisible by , So it's a leap year ; If B Year of B( Positive numbers ) Divide 4 more than 1, So it's also a leap year .
copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/02/202202041656041813.html
The sidebar is recommended
- Zhejiang University pat class B 1048 test points 4 and 5 cannot pass, solution
- Enter several student grades at random
- 7-3 simple character transformation (20 points)
- Question about CSS: since I have div nesting, how can I write CSS style
- What does this error message mean
- On the issue of CAS authentication, there is the problem of bill invalidation
- Why should e add 127 to e? Xiaobai said he didn't understand
- How can I get the value behind this k? Wentang college wants to use crawlers to crawl e-books.
- Pyqt5 how to output percentages directly?
- When the Android 10 app version is downgraded, you are prompted that the application is not installed. How to solve it?
guess what you like
-
Different expressions of month, month and day have been output. How to judge the season according to the output month
-
Canine distemper sports I Oh, afraid qwe
-
Short answer: SQL statements complete the following queries
-
What are the input formats of MySQL binlog?
-
What is the business logic of wordcount?
-
What is the function of terraform?
-
What are the four features of MySQL's InnoDB engine?
-
What are the instructions for configuring the task steps of DTS self built MySQL synchronization to RDS MySQL?
-
What is the process of installing other dependencies in ganglia?
-
What are the advantages and disadvantages of MySQL index?
Random recommended
- What are the instructions for configuring the processing mode of the target existing tables that DTS self built MySQL synchronizes to RDS MySQL?
- What is the core program running mechanism of MapReduce?
- What is the core competence of Alibaba cloud log service?
- What are the types of MySQL indexes?
- What is the description of the configuration of synchronization objects from DTS self built Mysql to RDS MySQL?
- What is the function of clusteringkey?
- What should I pay attention to when starting and using ECS?
- What is the description of the configuration of the mapping name change of DTS self built MySQL synchronized to RDS MySQL?
- What are the principles for creating indexes in MySQL?
- What is the description of the configuration of filtering data to be synchronized from DTS self built Mysql to RDS MySQL?
- What is the basic logic of MapReduce client for map phase parallelism planning?
- What is the description of the configuration of SQL operations for DTS self built MySQL synchronization to RDS MySQL synchronization?
- What is the leftmost and most prefixed principle of MySQL?
- What is the description of setting alarm configuration for DTS self built MySQL synchronization to RDS MySQL?
- What does MySQL overlay index and back table refer to?
- What are the instructions for configuring the case policy of the object name of the target database synchronized from DTS self built Mysql to RDS MySQL?
- How to pull data from maxcompute and upload results?
- How to use serverless log to realize alarm?
- What is optimizing bitmap indexing?
- Source table DMS_ ONLINE_ What is the description of whether to copy the temporary table to the target library during DDL?
- Will MySQL's non clustered indexes be queried back to the table?
- How to schedule periodically in maxcompute?
- What are the instructions for configuring the retry time after DTS self built MySQL is synchronized to RDS MySQL's source database and target database cannot be connected?
- Why should MySQL pay attention to the order in the composite index?
- What is an object storage OSS?
- What are the characteristics of the seamless connection between cloud storage and maxcomputesql?
- What is the definition of MySQL database transaction?
- What are the steps of hologres real-time writing and point query?
- What is machine learning Pai?
- What source databases are supported for synchronization between RDS and MySQL instances?
- What target databases are supported for synchronization between RDS and MySQL instances?
- What are the prerequisites for supporting synchronization between RDS and MySQL instances?
- What are the three implications of MapReduce?
- What are the data formats supported by maxcomputesql
- What is hologres' view of the execution plan?
- What are the source database restrictions for synchronization between RDS and MySQL instances?
- What is the difference between physical server and cloud server?
- What is the origin of MapReduce?
- What is the description of the special case of synchronization between RDS and MySQL instances?
- What is the synchronization architecture supported for synchronization between RDS and MySQL instances?