mysql time type display 12:00 AM as default value
$s=00:00:00 ( default开发者_StackOverflow社区 value in time type filed in database)
if i do $sp=date('g:i A',strtotime($s));
then it return 12:00 AM
i want that if there is a default value in database then it doesn't display any time or make it blank for further use
$time = strtotime($s);
if($s == "00:00:00")
{
// default time
}
else
{
$sp = date("g:i A", strtotime($s));
}
Just to make sure you know, 00:00:00 is 12:00 AM. More specifically, it is Janurary 1st, 1970, 12:00 AM.
精彩评论