2010-01-30 131 views
0

$ S = 00:00:00(在数据库归档时间类型默认值)mysql的时间型显示12:00 AM为默认值

如果我这样做$sp=date('g:i A',strtotime($s));然后返回​​

我想如果有在数据库中的默认值,那么它不会显示任何时间或使其空白进一步使用

回答

1
$time = strtotime($s); 
if($s == "00:00:00") 
{ 
    // default time 
} 
else 
{ 
    $sp = date("g:i A", strtotime($s)); 
} 

只是为了确保你知道,00:00:00是12:00 AM。更具体地说,是Janurary 1st,1970,12:00 AM。

+0

谢谢先生,请你看看我最后两个有关mysql中时间数据类型字段的问题 – diEcho 2010-01-30 14:44:04