php,怎样把date("Y-m-d H:i:s ") 换算成time()结构

我数据库l里时间格式为 2012-11-02 08:36:51 假设它为变量 $a 怎么换算成time()格式的,也就是这种 1362112369?求代码和解释说明,谢谢!
本意是让用户当时的时间减去之前他写入数据库时间,而得到一个数值,来判断一个行为

strtotime("2012-11-02 08:36:51");

这个是字符串转换成时间戳
数据库读出来就这样写
strtotime($rs['posttime']);

time()这个是输出当前时间的时间戳

strtotime还可以这样用,自己试试
echo(strtotime("now"));
echo(strtotime("3 October 2005"));
echo(strtotime("+5 hours"));
echo(strtotime("+1 week"));
echo(strtotime("+1 week 3 days 7 hours 5 seconds"));
echo(strtotime("next Monday"));
echo(strtotime("last Sunday"));
温馨提示:内容为网友见解,仅供参考
第1个回答  2013-03-01
汗 那直接用replace()替换成你想要的得了 time()这是一个输出时间戳
第2个回答  2013-03-01
那个叫unix时间戳~
用strtotime()函数将某个函数转换为时间戳
你下个PHP中文手册,这东西写程序必备
www.ctdisk.com/shared/folder_2445186_e9c89f3f/追问

也谢谢你

第3个回答  2013-03-01
在我关注的关键词问题列表下回答5个问题,百度知道将为您推荐最新的与定制关键词相关的问题。
相似回答