A simple implementation of PHP Timestamp and specific time conversion, and a specific php time Conversion

Source: Internet
Author: User

A simple implementation of PHP Timestamp and specific time conversion, and a specific php time Conversion

Three built-in functions:

Time () // obtain the UNIX system timestamp mktime (hour, minute, second, month, day, year) // convert the specified time to the timestamp date (time format, timestamp) // converts the timestamp into a time for easy reading.

Time-> date:

$ Now = time (); echo "The timestamp is ". $ now; echo "created on ". date ("Y-m-d h: I: s", $ now); output: the time stamp is 1404610907. The creation date is 09:41:47.

Mktime-> date:

$ D = mktime (9, 41, 47, 7, 6, 2014); echo "The timestamp is ". $ d; echo "created on ". date ("Y-m-d h: I: s", $ d); output: the time stamp is 1404610907. The creation date is 09:41:47.

Note:

Generally, the time function is used to obtain the current timestamp by default during registration or login. When a business requires a specific time, the mktime function can be used to convert it to a specific timestamp according to the specific time, the date function can reverse the timestamp to a specific time for easy viewing.

The simple implementation of the above PHP Timestamp and specific time conversion is all the content that I have shared with you. I hope you can give us a reference and support for the customer's house.

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.