国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

PHP date() date function

PHP date() function

PHP date() function is used to format time/date.

PHP date() function

PHP date() function formats timestamps for readability Better date and time.

A timestamp is a character sequence that represents the date/time when a certain event occurred.

Syntax

string date ( string $format [, int $timestamp ] )

Parameters ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Description

format ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Specifies the format of the timestamp.

timestamp ? ? ? ? ? ? ? Optional. Specify timestamp. The default is the current date and time.


PHP Date() - Formatted date

The first required parameter format of the date() function is specified How to format date/time.

Here are some available characters:

· ? ? d - represents the day of the month (01 - 31)

· ? ? ? ? ? m - represents the month (01 - 12)

·???????? Y - represents the year (four digits)

For a list of all characters available in the format parameter, please consult our PHP Date reference manual, date() function.

You can insert other characters between letters, such as "/", "." or "-", so that you can add additional formats:

<?php
echo date("Y/m/d") . "<br>";
echo date("Y.m.d") . "<br>";
echo date("Y-m-d");
?>

???????????????????????????????????????????????????????????????????????????????????????????????????????????????? The format string can recognize the following formats. Parameter string

QQ圖片20161009143031.png

QQ圖片20161009143106.png


##Example

 <?php
 echo "date()函數(shù)輸出格式化日期:<br />";
 // 常用
 echo date("l") . "<br />";// 注意是字符L的小寫(xiě),不是1,也不是豎線
 echo date("Y-m-d H:i:s") . "<br />";
 echo date("Y/m/d") . "<br />";
 echo date("Y年m月d日 H時(shí)i分s秒") . "<br />";
 // 從日期格式的字符串中獲取日期2005-03-21
 echo date("Y-m-d",strtotime("2005-03-21 11:15:38"))."<br />";
 echo date("Y-m-d",strtotime("-1 days"))."<br />";// 昨天的日期
 echo date("Y-m-d",strtotime("-1 week"))."<br />";// 上個(gè)星期今天的日期
 echo date("Y-m-d",strtotime("-1 month"))."<br />";// 上個(gè)月今天的日期
 echo date("Y-m-d H",strtotime("next Thursday"));// 下個(gè)周四的日期和小
 echo date('Y-m-d',strtotime('2015-06-08 -2 days')); // 某個(gè)日期的前n天
 ?>

Full PHP Date reference Manual


For a complete reference manual for all date functions, please visit our Complete PHP Date Reference Manual.

This reference manual provides a brief description and application examples of each function!


Continuing Learning
||
<?php echo date("Y/m/d") . "<br>"; echo date("Y.m.d") . "<br>"; echo date("Y-m-d"); ?>
submitReset Code