PHP s time is a big problem

Updated on healthy 2024-05-10
15 answers
  1. Anonymous users2024-02-10

    time() returns the UNIX timestamp of the current time, i.e., the number of seconds from the UNIX era (00:00:00 GMT January 1, 1970) to the current time.

    Because PHP is a language that runs on a server, if you test it on your own machine, the time() function will read the time you pick up the device, convert it to seconds, and then change it to 00:00:00 to get the result.

    So, no matter how your time zone is set, as long as your local machine time does not change, the result returned by the time() function will not change. In the future, you don't need to use the time() function anymore and read $server[ directly'request_time'] to get the results.

  2. Anonymous users2024-02-09

    If the parameter is true, it will return 15 bits, otherwise it will return something like this: 1419902331

    echo microtime(1);

    It turns out that your 15 digits mean that there are no decimal places, but it is recommended that you use this.

  3. Anonymous users2024-02-08

    microtime() is subtle without parameters, and is enough for 15 bits.

  4. Anonymous users2024-02-07

    The default is 11 bits, and you can see if the database has fewer fields, preferably int(11).

  5. Anonymous users2024-02-06

    Return 15 digits, if you want to return 14 digits, change 16 to 15.

    function microtime_float()echo microtime_float();

    echo "

    echo time();

  6. Anonymous users2024-02-05

    You wrote it wrong, the minute you use the same m as the month, it's May, of course it shows 05, it should be.

    echo date('y-m-d h:i:s',time()) minutes you use the same m as the month, it's May, of course it shows 05.

    Minutes you use the same m as the month, it's May now, and of course it's 05.

  7. Anonymous users2024-02-04

    The php function time() returns the number of seconds from 00:00:00 on January 1, 1970 to the current time, which can be understood as a time expressed in seconds and expressed by integers.

    time()+3600 indicates the time after adding an hour (3600 seconds) to the current time.

  8. Anonymous users2024-02-03

    This is a matter of time difference, you can set the time difference in PHP to the time format of Shanghai.

  9. Anonymous users2024-02-02

    $time=time();It is stored in time in the form of 1304677030

    echo "$time"."

    $alter_time=date('y-m-d h-i-s',"$time");

    echo "$alter_time";

  10. Anonymous users2024-02-01

    time() is the timestamp of the current time.

    date('y-m-d h-i-s', time()) is the current time.

    y m d h i s are all changeable intermediate - can also be changed to something else!

  11. Anonymous users2024-01-31

    You use the date function to format the time.

  12. Anonymous users2024-01-30

    gmtime() I haven't used it. time() gets the current server time. But the version above. There is a bug with time().

    This bug doesn't necessarily happen. It was between 12 p.m. and 8 a.m. The time is the day before.

    That is, there was a difference of 8 hours before 8 a.m. Does gmtime() have something to do with this? I don't know.

    Solving the time() bug is to put it in.

    The preceding semicolon is removed. Then change to.

    asia/shanghai

  13. Anonymous users2024-01-29

    One is standard time and the other is local time, isn't that clear? For example, if the time zone of the mainland is +8, if you set it, then your time will get the mainland time, and your gmtime will get the mainland time -8

  14. Anonymous users2024-01-28

    ime() gets the current server time. But the version above. time() has a bug, which doesn't necessarily happen.

    It was between 12 p.m. and 8 a.m. The time is the day before. That is, there was a difference of 8 hours before 8 a.m.

    Does gmtime() have something to do with this? I don't know if the solution to the time() bug is to remove the semicolon in front of =. Then change to = asia shanghai

    One is standard time and one is local time. For example, if the time zone of the mainland is +8, if you set it, then your time will get the mainland time, and your gmtime will get the mainland time -8

  15. Anonymous users2024-01-27

    Maybe you don't set the time zone, the default is 0 time zone, and if you want to add 8 hours in China, you can set it.

    date_default_timezone_set('asia/shanghai');

Related questions
12 answers2024-05-10

Variables can be included in double quotes, where $str reads look at the sea"$str";It will recognize that $str is a variable and explain the contents of the variable to get it"look at the sea", and single quotes'$str'It is to output the string $str, depending on the situation. Sometimes you need to make up a SQL statement with some variables, and double quotation marks are useful. >>>More

27 answers2024-05-10

Mi Tu! me too!It's been two years since Moore was registered and I've seen it change. >>>More

7 answers2024-05-10

This is actually the growing pain.

You also know that if you hit him, you might get ostracized. >>>More

2 answers2024-05-10

The base cream with foundation is added, in addition to protecting the skin, the texture is light and refreshing, and the light base makeup makes the ** shiny, and the most important thing is breathable and comfortable. At present, there are more and more skin care products with a variety of effects such as foundation, sunscreen, nutrition, etc., which can also be said to be a development trend in the future. If you choose this product, then skin care becomes very simple, no need to apply layer by layer, just apply one product to achieve the triple effect of skin care, skin tone correction and sun protection. >>>More

4 answers2024-05-10

Hello, the economic problem is that there is excess production capacity, enterprises are under-employed, and many of them even fail to reach the break-even point, resulting in a large number of idle social resources, and it is necessary to leak and expand the sales market. A large number of ordinary people have limited incomes, resulting in insufficient purchasing power, which makes it difficult for the economy to develop further rapidly. Efforts should be made to continue to increase people's incomes. >>>More