Summary of date and time operations in the PHP Getting Started Tutorial (formatting, verification, retrieval, conversion, computation, etc)

Source: Internet
Author: User
This article describes the date and time operations in the PHP Getting Started Tutorial, this article summarizes and analyzes php's date and time verification, formatting, acquisition, conversion, computation, and other related operation skills based on the instance form, for more information about PHP date and time operations, see the following example. We will share this with you for your reference. The details are as follows:

Demo1.php

 

Demo2.php

 

Demo3.php

 

Demo4.php

 

Demo5.php

 26 [minutes] => 34 [hours] => 10 [mday] => 20 [wday] => 1 [mon] => 4 // [year] => 2015 [yday] => 109 [weekday] => Monday [month] => 1_l [0] => 1429526066) $ t = getdate (); echo $ t ['Year']; // pass a timestamp print_r (getdate (1029526066);?>

Demo6.php

 

Demo7.php

 

Demo8.php

 

Demo9.php

 = 60) {echo 'Ask this gentleman to have a rest. ';} Else {echo $ a;}?>

Demo10.php

 

Demo11.php

 '; // I started to set the time zone putenv ('tz = Asia/Shanghai'); echo date ('Y-m-d H: I: s');?>

Demo12.php

 '; // Start to configure the default time zone date_default_timezone_set ('Asia/Shanghai'); echo date ('Y-m-d H: I: s'); echo'
'; Echo date_default_timezone_get () ;?>

Demo13.php

 37 [tm_min] => 15 [tm_hour] => 19 // [tm_mday] => 20 [tm_mon] => 3 [tm_year] => 115 // [tm_wday] => 1 [tm_yday] => 109 [tm_isdst] => 0)?>

Demo14.php

 

I hope this article will help you with PHP programming.


For more articles on date and time operations (formatting, verification, retrieval, conversion, computation, and so on) in the PHP Getting Started Tutorial, please follow the PHP Chinese website!

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.