PHP printing techniques at any time_PHP tutorial

WBOY
Release: 2016-07-15 13:34:31
Original
1077 people have browsed it

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...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!