date时间格式

一些格式from:http://php.net/manual/en/class.datetime.php

c    ISO 8601 日期及时间(PHP 5 新加)    2004-02-12T15:19:21+00:00
// Prints: July 1, 2000 is on a Saturday
echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000));

// Prints something like: 2006-04-05T01:02:03+00:00
echo date('c', mktime(1, 2, 3, 4, 5, 2006));

// 输出类似: Monday
echo date("l");

// 输出类似:Monday 8th of August 2005 03:12:46 PM
echo date('l jS \of F Y h:i:s A');

// 输出:July 1, 2000 is on a Saturday
echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000));

/* 使用格式常量 */
// 输出类似: Mon, 15 Aug 2005 15:12:46 UTC
echo date(DATE_RFC822);

// 输出类似:2000-07-01T00:00:00+00:00
echo date(DATE_ATOM, mktime(0, 0, 0, 7, 1, 2000));

 

<?php
$tomorrow  = mktime(0, 0, 0, date("m")  , date("d")+1, date("Y"));
$lastmonth = mktime(0, 0, 0, date("m")-1, date("d"),   date("Y"));
$nextyear  = mktime(0, 0, 0, date("m"),   date("d"),   date("Y")+1);
?>

 

posted on 2015-12-29 15:37  阿卡贝拉  阅读(178)  评论(0)    收藏  举报