PHP printing implementation tips at any time _ PHP Tutorial

Source: Internet
Author: User
PHP printing implementation skills at any time. Today, I want to introduce you to printing any time code for PHP :? Phpdate_default_timezone_set (AsiaShanghai); $ adate (Y-m-dH: I: s, strtotime (-1day); echo $ a is about

PHP prints any 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 $;
  5. ?>

The above PHP print any time code can print the previous day, you can use a similar method to print any time you want to determine. Here, "-" indicates the corresponding time forward, and "+" indicates the corresponding time later.

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

Arbitrary PHP printing time code :? Php date_default_timezone_set ('Asia/Shanghai'); $ a = date ('Y-m-dH: I: S', strtotime ('-1day ')); echo $...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.