PHP time function: php date, Time function

Source: Internet
Author: User
Tags date format current time getdate integer month name string string format

Date ("Y-m-d", Time ()) gets a string of times in a particular format. Time () is a timestamp value, or it can be omitted, the default current time. You can also fill in the value.
All functions in PHP are in the Unix era, starting January 1, 1970. The date is the number of seconds to start at this time. When a function call is counted as a number of seconds from this time, it is treated as a (timestamp) timestamp.
local time function
1. String date (string Format,inieger timestamp)
The function returns a string representing the time, which is controlled by the string format.
Such as:
?
Print (Date ("Y year M month D Day");//output current, Month day.
Print (Date ("Y year M month D Day", 60*60*24*365*10);//Output January 1, 1980.
?>
Perhaps you would ask, "How come there is no timestamp?" If timestamp is empty, or does not write, it indicates that the current time timestamp is used.
The control character that represents the year: Y---Four-bit year y---two-bit years
The control character that represents the month: M---The month name from 1-12 months F---English month name m---abbreviated month
The control character that represents the day number: D---0 of the month before the date j--there is no 0 in front of the day number
The control character for the week: l--English week d--Week
The control character that represents the hour: h--from 1-12 hours h---from 0 to 23 hours
Represents the control character a---am or pm a---am or PM in the afternoon
The control character that represents the minute: I---Take a value of 00-59
Another z--date of the year
Take days in one months: echo date (' t ', Mktime (1,1,1, month,1, year));
2. Array getdate (integer timestamp)
The function returns a matrix.
Such as:
?
$current _date=getdate ();
Print ($current _date ("hours"));
Print ($current _date ("minutes");
Print ($current _date ("seconds");
?>
Description
Element description
Hours 24-hour format hour
Mday date in month
Minutes minutes
Mon numeric form of the month
Month Month full name
Seconds number of seconds
Wday from 0 to 6 of the number of weeks of the form
Weekday the name of the day of the week
Year years
0 time stamp that's the number of seconds from January 1, 1970 to now
Yday the date of the year in digital form
3. Boolean checkdate (integer month,integer day,integer year) This article links http://www.cxybl.com/html/wlbc/Php/20130622/38772.html

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.