Time difference in php computing

Source: Internet
Author: User
The first time the user went online in the format of 2012-07-1809: 07: 56, the time difference in php computing was 12 days. This time is counted from the first time he went online. the time format for his second launch is 2012-07-2506: 11: 56. check if he has expired. check the remaining trial time & nbsp; use p php to calculate the time difference.
The time format for the first user to go online is 09:07:56.
I asked him to try it for 12 days. This time starts from his first launch.

The time format for his second launch was 06:11:56.

Check whether it expires.

Calculate the remaining trial time.

Thanks for implementing it in php. it is unclear about time conversion.

------ Solution --------------------
The initialization is NULL.
The first launch. if it is NULL, it is set to now () timestamp type.
The second launch, if not NULL, takes out the time, using the PHP function time ()-$ item ['TT']> 12*3600
------ Solution --------------------
PHP code
$ D1 = new datetime ('2017-07-18 09:07:56 '); $ d2 = new datetime ('2017-07-25 06:11:56 '); print_r ($ d2-> diff ($ d1 ));

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.