Php timestamp and normal time display conversion code _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Php timestamp and normal time display conversion code. LieHuo03.Net teaches 23 Cheng in webpage Development. the time for submitting a form is often converted to a 10-digit timestamp format, but it is difficult for some people to call it, in the case of LieHuo03.Net (LieHuo03.Net), the time for submitting a form is usually converted to a 10-digit timestamp format during web development, some of them are difficult to call, so how can we call and convert them?

A: For example, if the variable you call is $ liehuo_times, the output statement in php is: , How is it, simple?

The time saved in mysql is a timestamp with 10 digits
How can I convert a function to a normal time function output?

Time ();
Returns the current time, but returns an integer.

You can format it.
Date ("Y-m-d H: I: s", time ());
In this way, the connections are displayed in minutes.
Date ("Y-m-d", time (); year, month, and day only

Echo "the time zone of the local machine:". date ("T ")."
";
Echo "PHP timestamp (UNIX seconds):". mktime ()."
";
Echo "PHP time (after local formatting):". date ("Y-m-d H: I: s ")."";
?>

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.