开发者

mysql time type display 12:00 AM as default value

开发者 https://www.devze.com 2022-12-18 19:12 出处:网络
$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

$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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号