PHP检查字符串是否为SQL时间戳

时间:2012-02-20 20:24:55

标签: php sql datetime timestamp

我需要创建一个PHP函数来检查字符串是否是SQL时间戳yyyy-mm-dd hh:mm:ss [.fff]。有没有人这样做过?建议?

1 个答案:

答案 0 :(得分:2)

$match_pattern = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}:\d{2}:\d{2}-\d{2}:\d{2})/";