What are JavaScript time functions and mathematical operation functions?
Today, I would like to share with you the relevant knowledge points of JavaScript time function and mathematical operation function, which are detailed and logical. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
1. Time function Date
1 、 Date
In JavaScript, you use the Date () function to get the time.
Var date = new Date ()
2. Create a specified time object
You need to pass a string representing the time in the constructor as a parameter, the format of the date month / day / year: minutes: seconds
Var date2 = new Date ("11 Compact 2 Universe 20 21 18:15:00")
3. GetDate ()
Gets the number of days the current date object is.
4. GetDay ()
Gets the day of the week of the current date object and returns a value of 0-6. 0 means Sunday and 1 means Monday. no, no, no.
5. GetMonth ()
Gets the month of the current time object, with 0 for January and 1 for February.
6. GetFullYear ()
Get year
7. GetTime ()
Gets the timestamp of the current date object.
Timestamp, which refers to the number of milliseconds spent from 00:00:00 GMT on January 1, 1970 to the current date (1 second = 1000 milliseconds), which is used by the underlying computer to save time.
8. Use timestamps to test the performance of code execution
Var start = Date.now ()
For (var iTunes 0; I