PHP --- date and time

Source: Internet
Author: User
: This article mainly introduces PHP-date and time. For more information about PHP tutorials, see. Obtain the current Unix timestamp

From (00:00:00)-The number of seconds and

Get current date

Date ();

Date (the format of the timestamp, specifying the timestamp [current date and time by default, optional ])

// Date function, the second parameter returns the default value echo date ("Y-m-d"); // 2014-03-30 // date function, echo date ("Y-m-d", '000000') when the second parameter has a value; // 2014-03-30, 1396193923 indicates the unix timestamp of 1396193923

Obtain the timestamp of a date.

Strtotime ();

Strtotime (""); strtotime (""); // The test is also feasible

Converts formatted date strings to Unix timestamps.

strtotime("now");strtotime("+1 seconds");strtotime("+1 day");strtotime("+1 week");strtotime("+1 week 3 days 7 hours 5 seconds");

Format GMT Standard Time

// gmdate() //Y-m-d H:i:sdate_default_timezone_set("Asia/Shanghai");echo date('Y-m-d H:i:s', time());echo gmdate('Y-m-d H:i:s', time());

'). AddClass ('pre-numbering '). hide (); $ (this ). addClass ('Has-numbering '). parent (). append ($ numbering); for (I = 1; I <= lines; I ++) {$ numbering. append ($ ('
  • '). Text (I) ;}; $ numbering. fadeIn (1700) ;}) ;}; script

    The above section introduces PHP-date and time, including related content, and hopes to help friends who are interested in PHP tutorials.

    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.