php date() function


  Translation results:

英[deɪt] 美[det]

n.Date; date, day; era, year; (of date palm trees common in North Africa and West Asia) date palm

vt. Outdated; to make... appear older; to show the era (or age) of...; to identify the age of... Calculate the date from a certain time; record the date; note (or indicate) the date

Third person singular: dates Plural: dates Present participle: dating Past tense: dated Past participle: dated

php date() functionsyntax

Function:Format the timestamp into a more readable date and time.

Syntax: date(format,timestamp)

Parameters:

ParametersDescription
format Required. Specifies the format of the timestamp.
timestamp Optional. Specify timestamp. The default is the current time and date.

Note: The format parameters of the date() function are required, and they specify how to format the date or time.

php date() functionexample

<?php
echo date("Y-m-d",1335283200);
?>

Run instance»

Click the "Run instance" button to view the online instance

Output:

2012-04-25


<?php
//将时间戳以年月日时分秒的形式输出
echo date("Y-m-d H:i:s",1335283200);
?>

Run Instance»

Click the "Run Instance" button to view the online instance

Output:

2012-04-24 16:00:00

Popular Recommendations

Home

Videos

Q&A