Home  >  Article  >  Backend Development  >  PHP printing techniques at any time_PHP tutorial

PHP printing techniques at any time_PHP tutorial

WBOY
WBOYOriginal
2016-07-15 13:34:311078browse

What I want to introduce to you today is about

PHP printing arbitrary time code:

  1. < ?php
  2. date_default_timezone_set
    ('Asia/Shanghai');
  3. $a = date ('Y-m-d H:i:s',
    strtotime('-1 day'));
  4. echo $a;
  5. ?>

The above PHP print any time code can print the day before Time, use a similar method to print any specific time you require. Among them - is the corresponding time in the past, and + is the corresponding time in the future.

  1. -1 year
  2. -1 month
  3. -1 day
  4. -1 hour
  5. -1 minute
  6. -1 second

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445991.htmlTechArticleWhat I want to introduce to you today is about PHP printing arbitrary time code: ?php date_default_timezone_set ('Asia/Shanghai '); $ a = date ('Y-m-dH:i:s', strtotime('-1day')); echo$a...
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