Home >Backend Development >PHP Problem >How to determine if the timestamp is today in php

How to determine if the timestamp is today in php

藏色散人
藏色散人Original
2020-08-19 10:09:175856browse

php determines whether the timestamp is today's implementation method: first create a PHP sample file; then obtain the timestamp through the time function; then pass "if(date('Ymd', $timestamp) == date( 'Ymd')) {}" method can be used to determine whether the timestamp is today.

How to determine if the timestamp is today in php

Recommendation: "PHP Video Tutorial"

php determines whether it is like today

<?php
 
$timestamp = time();  // 时间戳
 
if(date(&#39;Ymd&#39;, $timestamp) == date(&#39;Ymd&#39;)) {
     
    echo &#39;今天&#39;;
     
}

Yes, as long as you judge the day after the month, you can know whether it has already happened once today, or whether it is today.

The above is the detailed content of How to determine if the timestamp is today in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn