php 时间处理函数--获取某个间隔前的日期

例子:

   获取90秒前的时间点:

$d= time();
echo $d;
$c=date("Y-m-d H:i:s",$d-90);
$e=date("Y-m-d H:i:s",$d);
echo "/n";
echo $c."---".$e;

显示结果:

1275906638 2010-06-07 18:29:08---2010-06-07 18:30:38

 

 

Date Format in PHP for date month year and time

Characters used for formating string in PHP date format
a'am' or 'pm'
A'AM' or 'PM'
BSwatch Internet time
dday of the month, 2 digits with leading zeros; i.e. '01' to '31'
Dday of the week, textual, 3 letters; i.e. 'Fri'
Fmonth, textual, long; i.e. 'January'
ghour, 12-hour format without leading zeros; i.e. '1' to '12'
Ghour, 24-hour format without leading zeros; i.e. '0' to '23'
hhour, 12-hour format; i.e. '01' to '12'
Hhour, 24-hour format; i.e. '00' to '23'
iminutes; i.e. '00' to '59'
I (capital i)'1' if Daylight Savings Time, '0' otherwise.
jday of the month without leading zeros; i.e. '1' to '31'
l (lowercase 'L')day of the week, textual, long; i.e. 'Friday'
Lboolean for whether it is a leap year; i.e. '0' or '1'
mmonth; i.e. '01' to '12'
Mmonth, textual, 3 letters; i.e. 'Jan'
nmonth without leading zeros; i.e. '1' to '12'
rRFC 822 formatted date; i.e. 'Thu, 21 Dec 2000 16:01:07 +0200' (added in PHP 4.0.4)
sseconds; i.e. '00' to '59'
SEnglish ordinal suffix, textual, 2 characters; i.e. 'th', 'nd'
tnumber of days in the given month; i.e. '28' to '31'
TTimezone setting of this machine; i.e. 'MDT'
Useconds since the epoch
wday of the week, numeric, i.e. '0' (Sunday) to '6' (Saturday)
Yyear, 4 digits; i.e. '1999'
yyear, 2 digits; i.e. '99'
zday of the year; i.e. '0' to '365'
Ztimezone offset in seconds (i.e. '-43200' to '43200'). The offset for timezones west of UTC is always negative, and for those east of UTC is always positive.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值