Date correlation function

Source: Internet
Author: User
Date function

Date ($format "$time");

Description

???? Formats $time the specified timestamp using the $format format string pair.

The $format time format string is as follows:

Y???????? 4-bit year

Y???????? 2-bit year

M???????? English abbreviation Month

M???????? Month with leading zeros

D???????? Day of the week of 3 characters

D???????? Date with leading zeros

H???????? 24 Hours of production information

H???????? 12-hour Letter from

I???????? Represents minutes

s???????? Represents seconds

PHP has a very powerful function for time operations. When you stock time information to the data, you typically save a timestamp.

Time Origin: The computer world is set to January 1, 1970 0:0 0 seconds, the time origin

Timestamp: From the time origin to the current number of seconds (JS is the number of milliseconds).

Time zone settings:

Date_default_timezone_set (' PRC ');

?

Mktime (); Gets the timestamp of the specified time

If you want to format the display of any time, you need to use date, but the date's time parameter can only be a timestamp. So you need to use mktime for formatting.

Time (); timestamp

Mktime (hours, seconds, months, days, years);

???? Gets the timestamp at the specified point in time

Example:

Date correlation function

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.