php类论坛数据库中的时间:1178287713 怎么得到的? php类论坛数据库中的时间:1178287713 怎么得到的? 例如发贴时间.怎么看不到和日期有什么联系啊?在mysql内部有没有这样的函数,可以把当前时间转换成这样的一串数字? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 function GetMkTime($dtime){ if(!ereg("[^0-9]",$dtime)) return $dtime; $dt = Array(1970,1,1,0,0,0); $dtime = ereg_replace("[\r\n\t]|ÈÕ|Ãë"," ",$dtime); $dtime = str_replace("Äê","-",$dtime); $dtime = str_replace("ÔÂ","-",$dtime); $dtime = str_replace("ʱ",":",$dtime); $dtime = str_replace("·Ö",":",$dtime); $dtime = trim(ereg_replace("[ ]{1,}"," ",$dtime)); $ds = explode(" ",$dtime); $ymd = explode("-",$ds[0]); if(isset($ymd[0])) $dt[0] = $ymd[0]; if(isset($ymd[1])) $dt[1] = $ymd[1]; if(isset($ymd[2])) $dt[2] = $ymd[2]; if(strlen($dt[0])==2) $dt[0] = '20'.$dt[0]; if(isset($ds[1])){ $hms = explode(":",$ds[1]); if(isset($hms[0])) $dt[3] = $hms[0]; if(isset($hms[1])) $dt[4] = $hms[1]; if(isset($hms[2])) $dt[5] = $hms[2]; } foreach($dt as $k=>$v){ $v = ereg_replace("^0{1,}","",trim($v)); if($v=="") $dt[$k] = 0; } $mt = @mktime($dt[3],$dt[4],$dt[5],$dt[1],$dt[2],$dt[0]); if($mt>0) return $mt; else return mytime();}我在他们的源文件中找到上到的代码, 上面是什么意思? 偶不懂PHP. 上面的代码是不是把时间转换成类似1178287713字符串的? 如果是, 这种函数能不能在mysql的存储过程中实现? time()可以把时间转换成类似1178287713字符串的? 相关贴:http://community.csdn.net/Expert/topic/5510/5510978.xml?temp=.172558高分求高手ing :) 这应该是UNIX时间戳,UNIX系统以1970年1月1日作为系统时间的起点,从那一刻起每过一秒,UNIX系统时间记数器就递加一个1,由此得到的整数被称为"UNIX时间戳"Mysql函数FROM_UNIXTIME()和UNIX_TIMESTAMP()可以完成MYSQL日期与UNIX时间戳的相互转换,如执行SQL语句:select now(), unix_timestamp(now())得到2007-05-05 23:00:18 117877218执行SQL语句:select from unixtime(1178287713)得到2007-05-04 22:08:33 报表界面,参数输入如何控制 求一个sql语句 varchar与char的基础疑惑问题 mysql创建存储过程出错 mysqldump 导出指定行 谈谈SUN被Oracle收购后 My SQL的出路何在呢? 如何修改视图的显示为utf8????(系统好象默认为latin 从上面可以看出来) 紧急求助PHP+mysql问题 请问在Delphi7+dbExpress+Mysql中如何有效的备份/恢复数据库数据? 求mysql数据库的max_allowed_packet修改为32m之后,自动被还原为默认值的原因及解决方法 请教mysql驱动问题 随机取数据问题
{
if(!ereg("[^0-9]",$dtime)) return $dtime;
$dt = Array(1970,1,1,0,0,0);
$dtime = ereg_replace("[\r\n\t]|ÈÕ|Ãë"," ",$dtime);
$dtime = str_replace("Äê","-",$dtime);
$dtime = str_replace("ÔÂ","-",$dtime);
$dtime = str_replace("ʱ",":",$dtime);
$dtime = str_replace("·Ö",":",$dtime);
$dtime = trim(ereg_replace("[ ]{1,}"," ",$dtime));
$ds = explode(" ",$dtime);
$ymd = explode("-",$ds[0]);
if(isset($ymd[0])) $dt[0] = $ymd[0];
if(isset($ymd[1])) $dt[1] = $ymd[1];
if(isset($ymd[2])) $dt[2] = $ymd[2];
if(strlen($dt[0])==2) $dt[0] = '20'.$dt[0];
if(isset($ds[1])){
$hms = explode(":",$ds[1]);
if(isset($hms[0])) $dt[3] = $hms[0];
if(isset($hms[1])) $dt[4] = $hms[1];
if(isset($hms[2])) $dt[5] = $hms[2];
}
foreach($dt as $k=>$v){
$v = ereg_replace("^0{1,}","",trim($v));
if($v=="") $dt[$k] = 0;
}
$mt = @mktime($dt[3],$dt[4],$dt[5],$dt[1],$dt[2],$dt[0]);
if($mt>0) return $mt;
else return mytime();
}我在他们的源文件中找到上到的代码, 上面是什么意思? 偶不懂PHP. 上面的代码是不是把时间转换成类似1178287713字符串的? 如果是, 这种函数能不能在mysql的存储过程中实现?
http://community.csdn.net/Expert/topic/5510/5510978.xml?temp=.172558高分求高手ing :)
UNIX系统以1970年1月1日作为系统时间的起点,从那一刻起每过一秒,UNIX系统时间记数器就递加一个1,由此得到的整数被称为"UNIX时间戳"
Mysql函数FROM_UNIXTIME()和UNIX_TIMESTAMP()可以完成MYSQL日期与UNIX时间戳的相互转换,
如执行SQL语句:
select now(), unix_timestamp(now())
得到
2007-05-05 23:00:18 117877218
执行SQL语句:
select from unixtime(1178287713)
得到
2007-05-04 22:08:33