我面临一个问题。在我的 MySQL 日期时间字段中存储了一些值,例如 0000-00-00,我需要检查这些值。我在下面解释我的代码。
if (strtotime($data['actualdateofaudit']) == 0) {
$data['actualdateofaudit']='';
}else{
$data['actualdateofaudit'] = date('d-m-Y', strtotime($data['actualdateofaudit']));
}
这里actualdateofaudit
是我的日期时间字段列名称。就我而言,我无法检查是否有像 0000-00-00
这样的值。这里我需要检查这些类型值。
最佳答案
试试这个
if (strtotime($data['actualdateofaudit'])) {
$data['actualdateofaudit'] = date('d-m-Y', strtotime($data['actualdateofaudit']));
}else{
$data['actualdateofaudit']='';
}
关于php - 无法使用 PHP 检查日期时间字段值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47939411/