


Detailed explanation of the function of Javascript new Date().valueOf() and the origin of timestamp_Basic knowledge
As we all know, time type data in PHP can be directly converted into timestamps. In front-end script js, there is also a way to achieve this, which is valueOf()
For example, we can use this code to output the timestamp of the current time point
So what is a timestamp?
The timestamp is all the seconds from 0:00:00 on January 1, 1970 to the current time point. 1970.1.1 0:0:0 This time is the so-called "time epoch" in IT. I believe you have seen it in many articles. For example, Oracle time display, time calculation in Unix and Linux systems, etc. Then why choose 1970 instead of 1900? Let us explain its origin next.
1. When 32-bit computers just started to emerge,
The maximum value that the so-called integer type data can represent is:
System.out.println(Integer.MAX_VALUE);
2147483647
2. The total number of seconds of 365 in a year is 31536000,
3. Divide the two, 2147483647/31536000=68.1,
4. In other words, in the context of 32 bits, the maximum value that can be expressed The long-term interval is 68 years
5. If you count from 1970, it can be said that the maximum time will be reached at 03:14:07 on January 19, 2038,
6. After this time point, The time of all 32-bit operating systems will become 10000000 00000000 00000000 00000000
which is 20:45:52 on December 13, 1901. This will cause time regression, and some software may have major abnormalities.
To summarize the above points, the people who came up with this set of things were actually those who were playing with UNIX at the earliest. They considered that 68 years is not that long, so they started counting these 68 years from 1970. Their hopes Yes, during these 68 years, those who came later could come up with a better mechanism as soon as possible to change this restriction. . . Sure enough, the rise of 64-bit has changed this "end of time" from
January 19, 2038, 03:14:07 - " 292,277,026,596 December 4, 15:30:08
So, this If the number is big enough, the "end of the world" of computer time will really be the end of the world
Code changes the world, my "Source Code", my world!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



How to use WebSocket and JavaScript to implement an online speech recognition system Introduction: With the continuous development of technology, speech recognition technology has become an important part of the field of artificial intelligence. The online speech recognition system based on WebSocket and JavaScript has the characteristics of low latency, real-time and cross-platform, and has become a widely used solution. This article will introduce how to use WebSocket and JavaScript to implement an online speech recognition system.

Golang time conversion: How to convert timestamp to string In Golang, time operation is one of the very common operations. Sometimes we need to convert the timestamp into a string for easy display or storage. This article will introduce how to use Golang to convert timestamps to strings and provide specific code examples. 1. Conversion of timestamps and strings In Golang, timestamps are usually expressed in the form of integer numbers, which represent the number of seconds from January 1, 1970 to the current time. The string is

WebSocket and JavaScript: Key technologies for realizing real-time monitoring systems Introduction: With the rapid development of Internet technology, real-time monitoring systems have been widely used in various fields. One of the key technologies to achieve real-time monitoring is the combination of WebSocket and JavaScript. This article will introduce the application of WebSocket and JavaScript in real-time monitoring systems, give code examples, and explain their implementation principles in detail. 1. WebSocket technology

In Go, you can use regular expressions to match timestamps: compile a regular expression string, such as the one used to match ISO8601 timestamps: ^\d{4}-\d{2}-\d{2}T \d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-][0-9]{2}:[0-9]{2})$ . Use the regexp.MatchString function to check if a string matches a regular expression.

JavaScript and WebSocket: Building an efficient real-time weather forecast system Introduction: Today, the accuracy of weather forecasts is of great significance to daily life and decision-making. As technology develops, we can provide more accurate and reliable weather forecasts by obtaining weather data in real time. In this article, we will learn how to use JavaScript and WebSocket technology to build an efficient real-time weather forecast system. This article will demonstrate the implementation process through specific code examples. We

Golang Programming Tool: Best Practices for Timestamp Obtaining Introduction: In software development, timestamp is a very common concept. It is a numeric value that identifies the occurrence of a specific event, usually representing the number of milliseconds or nanoseconds since some reference point in time. In Golang, processing timestamps is very simple and efficient. This article will introduce the best practices for obtaining timestamps in Golang and provide specific code examples. Text: Get the current timestamp In Golang, getting the current timestamp is very simple. we can

JavaScript tutorial: How to get HTTP status code, specific code examples are required. Preface: In web development, data interaction with the server is often involved. When communicating with the server, we often need to obtain the returned HTTP status code to determine whether the operation is successful, and perform corresponding processing based on different status codes. This article will teach you how to use JavaScript to obtain HTTP status codes and provide some practical code examples. Using XMLHttpRequest

Timestamp in PHP is an integer form representing time, usually the number of seconds that have passed since the first year of Unix (January 1, 1970 00:00:00 GMT). In programming, we often need to convert timestamps into other forms of integers. Here we will introduce how to convert PHP timestamps into integers, as well as specific code examples. In PHP, we can use the strtotime() function to convert the time string to a timestamp and then use date
