mysql正则年月日或年月日时分秒

mysql正则年月日或年月日时分秒

$sql = "SELECT count(*) as count FROM ".$this->tableName." WHERE ".$field."!='' and (".$field." NOT REGEXP '^[0-9]{4}-[0-9]{2}-[0-9]{2}( [0-9]{2}:[0-9]{2}:[0-9]{2})?$' and ".$field." NOT REGEXP '^[0-9]{4}/[0-9]{2}/[0-9]{2}( [0-9]{2}:[0-9]{2}:[0-9]{2})?$')";

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: