Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are JavaScript time functions and mathematical operation functions?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report