Php powerful time conversion function strtotime, php function strtotime_PHP tutorial

Source: Internet
Author: User
Php's powerful time conversion function strtotime and php function strtotime. Php's powerful time conversion function strtotime. php's strtotime function uses strtotime to convert Time strings of various formats into timestamps to convert conventional time formats echodate (Y-m-dH: I: powerful time conversion functions of php, strtotime function of php

You can use strtotime to convert Time strings of various formats into timestamps.

Convert regular time format

echo date('Y-m-d H:i:s', strtotime('2016-01-30 18:00')).PHP_EOL;echo date('Y-m-d H:i:s', strtotime('20160130180001')).PHP_EOL; 

Change Natural Time description

// Yesterday echo date ('Y-m-d H: I: S', strtotime ('Yesterday ')). PHP_EOL; // last week echo date ('Y-m-d H: I: S', strtotime ('last week ')). PHP_EOL; // this week's start time echo date ('Y-m-d H: I: S', strtotime ('this week midnight ')). PHP_EOL; // this month start time echo date ('Y-m-d H: I: S', strtotime ('first day of this month midnight ')). PHP_EOL; // calculate the relative time echo date ('Y-m-d H: I: S', strtotime ('+ 1 month ')). PHP_EOL;

Complete php Time description document can refer to http://php.net/manual/zh/datetime.formats.relative.php

Articles you may be interested in:
  • PHP strtotime functions
  • Php in-depth understanding of the use of strtotime functions
  • PHP timestamp strtotime () usage and tips
  • Php uses the strtotime and date functions to determine whether the date is valid for code sharing
  • PHP obtains the date (strtotime, date) of the previous month, next month, and this month)
  • Php uses the date and strtotime functions to output the method of specifying a date
  • Js imitates strtotime () and date () functions in php.
  • PHP uses strtotime to obtain the date of the previous month, next month, and this month

Use strtotime to convert Time strings of various formats into timestamps. convert conventional time formats echo date ('Y-m-d H: I :...

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.